Beispiel #1
0
 public function deleteAll($attributeValue, $attributeName = 'Id')
 {
     /** @var $criteria AbstractCriteria */
     $criteria = $this->criteriaFactory->getNativeCriteria($attributeName, $attributeValue);
     $collection = $this->repository->findMany($criteria);
     if (!$collection->count()) {
         $this->setErrors(array('general' => 'Entities does not found.'));
         return false;
     }
     $this->repository->deleteByAttribute($attributeValue, $criteria->getField());
     $this->trigger('deleteAll:post', $collection, 'collection');
     return $collection;
 }
Beispiel #2
0
 public function updateAll($attributeValue, $attributeName = 'id', array $data)
 {
     $criteria = $this->criteriaFactory->getNativeCriteria($attributeName, $attributeValue);
     $collection = $this->repository->findMany($criteria);
     if (!$collection->count()) {
         return false;
     }
     $this->repository->updateByAttribute($data, $attributeValue, $criteria->getField());
     return $collection;
 }