public function renderTag($internal_id) { $this->template->pages = $this->pages; $tag = null; if ($internal_id !== null) { $tag = $this->tagFacade->getById($internal_id); } $this->template->tag = $tag; }
/** * @param int $tagId * @return Tag */ private function getTag($tagId) { if (empty($this->tags)) { // if processing "handle" method, $this->tags is always empty array // because this factory is invoked before render method $tag = $this->tagFacade->getById($tagId); if ($tag === null) { // trying to request non-existing tag $this->onMissingTag($this); // there is happening redirect } $this->tags[$tagId] = $tag; } else { // common request $tag = $this->tags[$tagId]; } return $tag; }