/** * Generate a response that displays an entity's data. * * @param \Eix\Services\Data\Entity $entity * @return Response */ protected function getViewResponse(Entity $entity) { $response = $this->getHtmlResponse(); $response->setTemplateId($this->getViewTemplateId()); $response->setData($this->getItemName(), $entity->getFieldsData()); $response->appendToTitle(sprintf(_('%s %s'), ucfirst($this->getItemName()), $entity->getId())); return $response; }
/** * Return a response that shows an edition page. * @param type $id the ID of the entity to edit, if any. * @return Html */ protected function getEditionResponse(Entity $entity = null) { // Create a new HTML response. $response = $this->getHtmlResponse(); // Indicate where is the template. $response->setTemplateId(sprintf('%s/edit', $this->getCollectionName())); // If there is an entity ID, load that entity in the response as well. if ($entity) { $response->setData($this->getItemName(), $entity->getFieldsData()); } return $response; }