/** * @return \Gemtoo\Blog\Model\ResourceModel\Article\Collection */ public function getArticleCollection() { if (is_null($this->articleCollection)) { $this->articleCollection = $this->categoryModel->getSelectedArticlesCollection($this->getCategory())->addStoreFilter($this->_storeManager->getStore()->getId())->addFieldToFilter('is_active', 1); //TODO: use constant here $this->articleCollection->getSelect()->order('related_category.position'); } return $this->articleCollection; }
/** * @access public * @return array */ public function getSelectedArticles() { $articles = array(); $selected = $this->articleCategory->getSelectedArticles($this->getCategory()); if (!is_array($selected)) { $selected = array(); } foreach ($selected as $article) { /** @var \Gemtoo\Blog\Model\Article $article */ $articles[$article->getId()] = $article->getPosition(); } return $articles; }