Beispiel #1
0
 /**
  * @param $id
  * @param string $attribyteName
  * @return bool|EntityInterface
  */
 public function delete($id, $attribyteName = 'Id')
 {
     $this->entity = $this->repository->find($this->criteriaFactory->getNativeCriteria($attribyteName, $id));
     if (!$this->entity) {
         $this->setErrors(array('general' => sprintf("Entity #%s does not found.", $id)));
         return false;
     }
     $this->repository->delete($this->entity);
     $this->trigger('delete:post', $this->entity, 'entity');
     return $this->entity;
 }
Beispiel #2
0
 public function delete($id)
 {
     /** @var $entity \T4webBase\Domain\Entity */
     $entity = $this->repository->find($this->criteriaFactory->getNativeCriteria('Id', $id));
     if (!$entity) {
         return false;
     }
     $entity->setDeleted();
     $this->repository->add($entity);
     $this->trigger('delete:post', $entity);
     return true;
 }