/** * 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; }
/** * 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; }
/** * Flag the user as no longer in existence, so that it does not * automatically get saved in the session. */ public function destroy() { parent::destroy(); Logger::get()->debug('Destroying user ' . $this->id); // If this user is the one stored in the session, destroy that too. if (!empty($_SESSION) && $_SESSION['current_user'] == $this) { unset($_SESSION['current_user']); } }