Example #1
0
 /**
  * @return \Sample\News\Model\Resource\Author\Collection
  */
 public function getAuthorCollection()
 {
     if (is_null($this->authorCollection)) {
         $this->authorCollection = $this->categoryModel->getSelectedAuthorsCollection($this->getCategory())->addStoreFilter($this->_storeManager->getStore()->getId())->addFieldToFilter('is_active', 1);
         //TODO: use constant here
         $this->authorCollection->getSelect()->order('related_category.position');
     }
     return $this->authorCollection;
 }
Example #2
0
 /**
  * @access public
  * @return array
  */
 public function getSelectedAuthors()
 {
     $authors = array();
     $selected = $this->authorCategory->getSelectedAuthors($this->getCategory());
     if (!is_array($selected)) {
         $selected = array();
     }
     foreach ($selected as $author) {
         /** @var \Sample\News\Model\Author $author */
         $authors[$author->getId()] = $author->getPosition();
     }
     return $authors;
 }