コード例 #1
0
ファイル: Article.php プロジェクト: sourcefabric/newscoop
 /**
  * Get language name
  *
  * @return string
  */
 public function getLanguageName()
 {
     try {
         return $this->language ? $this->language->getName() : '';
     } catch (\Doctrine\ORM\EntityNotFoundException $e) {
         return '';
     }
 }
コード例 #2
0
ファイル: Article.php プロジェクト: alvsgithub/Newscoop
 /**
  * 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;
 }
コード例 #3
0
ファイル: Issue.php プロジェクト: sourcefabric/newscoop
 /**
  * Get language code
  *
  * @return string
  */
 public function getLanguageCode()
 {
     return $this->language !== null ? $this->language->getCode() : null;
 }
コード例 #4
0
ファイル: Section.php プロジェクト: nidzix/Newscoop
 /**
  * Get language name
  *
  * @return string
  */
 public function getLanguageName()
 {
     return $this->language->getName();
 }