예제 #1
0
 /**
  * Load entities ids list
  *
  * @return true|null true when there are ids retrieved
  */
 protected function findEntitiesToProcess()
 {
     if ($this->isInitialSync() && $this->isInitialDataLoaded) {
         $this->isInitialDataLoaded = false;
         return null;
     }
     $now = new \DateTime($this->transport->getServerTime(), new \DateTimeZone('UTC'));
     $this->logger->info('Looking for batch');
     $this->entitiesIdsBuffer = $this->getEntityIds();
     if (!$this->isInitialSync()) {
         //increment date for further filtering
         $this->lastSyncDate->add($this->syncRange);
     }
     $this->logger->info(sprintf('found %d entities', count($this->entitiesIdsBuffer)));
     if ($this->isInitialSync()) {
         $this->isInitialDataLoaded = true;
     } elseif (empty($this->entitiesIdsBuffer)) {
         if ($this->lastSyncDate >= $now) {
             return null;
         }
         return true;
     }
     return empty($this->entitiesIdsBuffer) ? null : true;
 }