/** * @param array $data * @return EntityInterface|null */ public function create(array $data) { if (!$this->isValid($data)) { return; } $data = $this->inputFilter->getValues(); if (empty($data)) { throw new \RuntimeException("Cannot create entity form empty data"); } $entity = $this->entityFactory->create($data); $this->repository->add($entity); $this->trigger($entity); return $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; }