Пример #1
0
 /**
  * Iterate a collection with the correct callback.
  *
  * @param \Percy\Entity\Collection $collection
  * @param string                   $callable
  *
  * @return boolean
  */
 protected function collectionIterator(Collection $collection, $callable, array $scopes = [])
 {
     $this->dbal->beginTransaction();
     try {
         foreach ($collection->getIterator() as $entity) {
             call_user_func_array([$this, $callable], [$entity, $scopes]);
         }
     } catch (PDOException $e) {
         $this->dbal->rollBack();
         return false;
     }
     $this->dbal->commit();
     return true;
 }