Наследование: extends Infusionsoft_DataService
 public static function queryWithOrderBy($object, $queryData, $orderByField = null, $ascending = true, $limit = 1000, $page = 0, $returnFields = false, Infusionsoft_App $app = null)
 {
     if (PHP_INT_SIZE < 8) {
         throw new Exception("This version oh php is not 64 bit it is " . PHP_INT_SIZE * 8 . ' bit.  ContactGroupAssign cannot be synced unless running on a 64bit version of php.');
     }
     Infusionsoft_ContactGroupAssign::removeField('Id');
     if (is_array($returnFields) && in_array('Id', $returnFields)) {
         unset($returnFields[array_search('Id', $returnFields)]);
         $returnFields[] = 'ContactId';
         $returnFields[] = 'GroupId';
         $returnFields = array_values($returnFields);
     }
     $results = Infusionsoft_DataService::queryWithOrderBy($object, $queryData, $orderByField, $ascending, $limit, $page, $returnFields, $app);
     Infusionsoft_ContactGroupAssign::addCustomField('Id');
     self::addCompoundKeyToResults($results);
     if ($orderByField == 'ContactId' && $ascending && count($results) > 0) {
         if ($page > 0) {
             self::removeRecordsForContactsAlreadyProcessed(self::$lastProcessedContactId, $results);
         }
         $lastRecordOfResultSet = end($results);
         $lastContactId = $lastRecordOfResultSet->ContactId;
         self::$lastProcessedContactId = $lastContactId;
         $foundLastRecordForLastContact = false;
         $extraPages = 1;
         while (!$foundLastRecordForLastContact && count($results) > 0) {
             Infusionsoft_ContactGroupAssign::removeField('Id');
             $extraResults = Infusionsoft_DataService::queryWithOrderBy($object, $queryData, $orderByField, $ascending, $limit, $page + $extraPages, $returnFields, $app);
             Infusionsoft_ContactGroupAssign::addCustomField('Id');
             self::addCompoundKeyToResults($extraResults);
             foreach ($extraResults as $extraResult) {
                 //If somehow, between calls, a lot of tags are applied, and our "last" contact gets pushed down to the second page, we need to not break because of new contacts higher up on the page.
                 if ($extraResult->ContactId <= $lastContactId) {
                     $results[] = $extraResult;
                 } else {
                     $foundLastRecordForLastContact = true;
                     break;
                 }
             }
             if (count($extraResults) == 0) {
                 $foundLastRecordForLastContact = true;
             }
             $extraPages++;
         }
         return $results;
     }
     /** @var Infusionsoft_ContactGroupAssign $result */
     return $results;
 }
 public function __construct($id = null, $app = null)
 {
     parent::__construct(null, $app);
     if ($id != null) {
         $results = Infusionsoft_ContactGroupAssignDataService::query(new Infusionsoft_ContactGroupAssign(), array('GroupId' => $id % 10000000, 'ContactId' => floor($id / 10000000)), 1, 0, array('ContactId', 'GroupId', 'DateCreated', 'ContactGroup'), $app);
         if (count($results) == 0) {
             throw new Infusionsoft_Exception("Could not load " . $this->table . " with id " . $id);
         }
         $object = $results[0];
         $this->GroupId = $object->GroupId;
         $this->ContactId = $object->ContactId;
         $this->ContactGroup = $object->ContactGroup;
         $this->DateCreated = $object->DateCreated;
         $this->data['Id'] = $this->ContactId * 10000000 + $this->GroupId;
     }
 }