Example #1
0
 /**
  * @param int $number
  * @param string $name
  * @param Newscoop\Entity\Issue $issue
  */
 public function __construct($number, $name, $issue = null)
 {
     $this->number = (int) $number;
     $this->name = (string) $name;
     if ($issue !== null) {
         $this->issue = $issue;
         $this->issue->addSection($this);
         $this->publication = $this->issue->getPublication();
         $this->language = $this->issue->getLanguage();
     }
 }
Example #2
0
 /**
  * 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;
 }
 public function testIsUsedIssueArticleTemplate()
 {
     $this->issue->setArticleTemplate($this->template);
     $this->flushAssertTrue();
 }
Example #4
0
 /**
  * Get name of Issue
  *
  * @return string
  */
 public function getIssueName()
 {
     return $this->issue->getName();
 }