public function reverseTransform($value) { if (!$value) { return; } $lead = $this->model->getEntity($value); if (null === $value) { throw new TransformationFailedException(sprintf('An Lead with id "%s" does not exist!', $value)); } return $lead; }
/** * Deletes an entity * * @param int $id Entity ID * * @return Response */ public function deleteEntityAction($id) { $entity = $this->model->getEntity($id); if (null !== $entity) { if (!$this->checkEntityAccess($entity, 'delete')) { return $this->accessDenied(); } $this->model->deleteEntity($entity); $this->preSerializeEntity($entity); $view = $this->view(array($this->entityNameOne => $entity), Codes::HTTP_OK); $this->setSerializationContext($view); return $this->handleView($view); } return $this->notFound(); }