/** * @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; }
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; }