예제 #1
0
 /**
  * @param \Spryker\Zed\Collector\Business\Collector\DatabaseCollectorInterface $collector
  * @param \Orm\Zed\Touch\Persistence\SpyTouchQuery $baseQuery
  * @param \Generated\Shared\Transfer\LocaleTransfer $locale
  * @param \Spryker\Zed\Collector\Business\Model\BatchResultInterface $result
  * @param \Spryker\Zed\Collector\Business\Exporter\Reader\ReaderInterface $dataReader
  * @param \Spryker\Zed\Collector\Business\Exporter\Writer\WriterInterface $dataWriter
  * @param \Spryker\Zed\Collector\Business\Exporter\Writer\TouchUpdaterInterface $touchUpdater
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return void
  */
 public function runCollector(DatabaseCollectorInterface $collector, SpyTouchQuery $baseQuery, LocaleTransfer $locale, BatchResultInterface $result, ReaderInterface $dataReader, WriterInterface $dataWriter, TouchUpdaterInterface $touchUpdater, OutputInterface $output)
 {
     $itemType = $baseQuery->get(SpyTouchTableMap::COL_ITEM_TYPE);
     $collector->deleteDataFromStore($touchUpdater, $dataWriter, $itemType);
     $batchCollection = $collector->collectDataFromDatabase($baseQuery, $locale);
     $collector->exportDataToStore($batchCollection, $touchUpdater, $result, $dataReader, $dataWriter, $locale, $output);
 }
 /**
  * @return void
  */
 private function performAssertion()
 {
     $query = SpyTouchQuery::create()->filterByItemType('product_abstract')->limit(2)->orderByIdTouch('desc')->find();
     $this->assertEquals(2, $query->count());
     foreach ($query as $touchEntity) {
         $this->assertContains($touchEntity->getItemId(), $this->productAbstractIds);
     }
 }
예제 #3
0
 /**
  * @return \Orm\Zed\Touch\Persistence\SpyTouchQuery
  */
 public function createTouchQuery()
 {
     return SpyTouchQuery::create();
 }
예제 #4
0
 /**
  * @param \Orm\Zed\Touch\Persistence\SpyTouchQuery $baseQuery
  *
  * @return array
  */
 protected function getTouchQueryParameters(SpyTouchQuery $baseQuery)
 {
     $result = [];
     $baseParameters = $baseQuery->getParams();
     foreach ($baseParameters as $parameter) {
         $key = sprintf('%s.%s', $parameter['table'], $parameter['column']);
         $value = $parameter['value'];
         if ($value instanceof \DateTime) {
             $value = $value->format(\DateTime::ATOM);
         }
         $result[$key] = $value;
     }
     return $result;
 }
 /**
  * @param \Orm\Zed\Touch\Persistence\SpyTouchQuery $touchQuery
  * @param \Generated\Shared\Transfer\LocaleTransfer $locale
  *
  * @return void
  */
 protected function prepareCollectorScope(SpyTouchQuery $touchQuery, LocaleTransfer $locale)
 {
     $touchQuery->addJoin(SpyTouchTableMap::COL_ID_TOUCH, SpyTouchSearchTableMap::COL_FK_TOUCH, Criteria::LEFT_JOIN);
     $touchQuery->withColumn(SpyTouchSearchTableMap::COL_ID_TOUCH_SEARCH, CollectorConfig::COLLECTOR_SEARCH_KEY);
     parent::prepareCollectorScope($touchQuery, $locale);
 }
 /**
  * @param int $idProductAbstract
  *
  * @return void
  */
 private function performAssertionOnTouchTable($idProductAbstract)
 {
     $query = SpyTouchQuery::create()->filterByItemType('product_abstract')->limit(1)->orderByIdTouch('desc')->find();
     $this->assertEquals(1, $query->count());
     foreach ($query as $touchEntity) {
         $this->assertEquals($touchEntity->getItemId(), $idProductAbstract);
     }
 }
예제 #7
0
 /**
  * @param \Orm\Zed\Touch\Persistence\SpyTouchQuery $query
  *
  * @return \Spryker\Shared\Library\BatchIterator\PropelBatchIterator
  */
 protected function getTouchIdsToRemoveBatchCollection(SpyTouchQuery $query)
 {
     $touchIdsToRemoveQuery = $query->select(SpyTouchTableMap::COL_ID_TOUCH);
     return $this->batchIteratorBuilder->buildPropelBatchIterator($touchIdsToRemoveQuery);
 }
예제 #8
0
 /**
  * @param int $itemId
  *
  * @return \Orm\Zed\Touch\Persistence\SpyTouch
  */
 protected function getTouchEntityByItemId($itemId)
 {
     $touchQuery = new SpyTouchQuery();
     $touchQuery->filterByItemType(self::ITEM_TYPE)->filterByItemId($itemId);
     return $touchQuery->findOne();
 }