Crm Demo Data - Out of memory
authorPaul Mehrer <p.mehrer@metaways.de>
Thu, 14 Apr 2016 09:09:02 +0000 (11:09 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 25 Apr 2016 15:12:52 +0000 (17:12 +0200)
using filters instead of getting all addressbook contacts
in order to minimize memory footprint

Change-Id: Ifd2d29abd0b35e5327690b226e5da49faaa71d4e
Reviewed-on: http://gerrit.tine20.com/customers/3049
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Crm/Setup/DemoData.php

index 98461dd..c028a72 100644 (file)
@@ -304,15 +304,20 @@ class Crm_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
      */
     protected function _createSharedLeads()
     {
-        $contacts = Addressbook_Controller_Contact::getInstance()->getAll();
-        $addresses = $contacts->filter('type', 'contact');
+        $contactController = Addressbook_Controller_Contact::getInstance();
+
+        $filter = new Addressbook_Model_ContactFilter(array(
+            array('field' => 'type', 'operator' => 'equals', 'value' => 'contact'),
+        ));
         $pagination = new Tinebase_Model_Pagination();
         $pagination->start = 0;
         $pagination->limit = 100;
-        $addresses->limitByPagination($pagination);
-        $users = $contacts->filter('type', 'user');
-        
-        unset($contacts);
+        $addresses = $contactController->search($filter, $pagination);
+
+        $filter = new Addressbook_Model_ContactFilter(array(
+            array('field' => 'type', 'operator' => 'equals', 'value' => 'user'),
+        ));
+        $users = $contactController->search($filter);
         
         $userids = $users->getId();