/**
  * @param string $itemType
  * @param string $itemEvent
  * @param array $itemIds
  *
  * @return int
  */
 protected function insertChunk($itemType, $itemEvent, array $itemIds)
 {
     $propelCollection = new ObjectCollection();
     $propelCollection->setModel(SpyTouch::class);
     foreach ($itemIds as $itemId) {
         $touchEntity = new SpyTouch();
         $touchEntity->setItemEvent($itemEvent)->setItemId($itemId)->setItemType($itemType)->setTouched(new \DateTime());
         $propelCollection->append($touchEntity);
     }
     $propelCollection->save();
     return $propelCollection->count();
 }
Exemple #2
0
 /**
  * @param string $itemEvent
  * @param int $itemId
  *
  * @return \Orm\Zed\Touch\Persistence\SpyTouch
  */
 protected function createTouchEntity($itemEvent, $itemId)
 {
     $touchEntity = new SpyTouch();
     $touchEntity->setItemEvent($itemEvent)->setItemId($itemId)->setItemType(self::ITEM_TYPE)->setTouched(new \DateTime());
     $touchEntity->save();
     return $touchEntity;
 }