/** * Get view * * @return object */ public function getView() { try { $view = new ArticleView(array('number' => $this->number, 'language' => $this->language->getCode(), 'languageId' => $this->language->getId(), 'title' => $this->name, 'updated' => $this->updated, 'published' => $this->published, 'indexed' => $this->indexed, 'onFrontPage' => $this->onFrontPage, 'onSection' => $this->onSection, 'type' => $this->type, 'webcode' => $this->getWebcode(), 'publication_number' => $this->publication ? $this->publication->getId() : null, 'issue_number' => $this->issue ? $this->issue->getNumber() : null, 'section_number' => $this->section ? $this->section->getNumber() : null, 'keywords' => array_filter(explode(',', $this->keywords)))); } catch (EntityNotFoundException $e) { return new ArticleView(); } $view->authors = $this->authors->map(function ($author) { return $author->getView()->name; })->toArray(); $view->topics = $this->topics->map(function ($topic) { return $topic->getView()->name; })->toArray(); $this->addFields($view); return $view; }
/** * Get publication Id * * @return int */ public function getPublicationId() { return $this->publication !== null ? $this->publication->getId() : null; }