Example #1
0
 /**
  * @param Article $article
  * @return mixed
  */
 public function getArticleUrl(Article $article)
 {
     if ($urlKey = $article->getUrlKey()) {
         $prefix = $this->scopeConfig->getValue(self::URL_PREFIX_CONFIG_PATH, ScopeInterface::SCOPE_STORE);
         $suffix = $this->scopeConfig->getValue(self::URL_SUFFIX_CONFIG_PATH, ScopeInterface::SCOPE_STORE);
         $path = ($prefix ? $prefix . '/' : '') . $urlKey . ($suffix ? '.' . $suffix : '');
         return $this->urlBuilder->getUrl('', ['_direct' => $path]);
     }
     return $this->urlBuilder->getUrl('gemtoo_blog/article/view', ['id' => $article->getId()]);
 }
Example #2
0
 /**
  * @param Article $article
  * @param $errorText
  * @return string
  */
 protected function getErrorWithArticleId(Article $article, $errorText)
 {
     return '[Article ID: ' . $article->getId() . '] ' . $errorText;
 }
Example #3
0
 /**
  * @param Article $article
  * @return $this
  */
 protected function doTheAction(Article $article)
 {
     $article->delete();
     return $this;
 }
Example #4
0
 /**
  * @param Article $article
  * @return $this
  */
 protected function doTheAction(Article $article)
 {
     $article->setIsActive($this->isActive);
     $article->save();
     return $this;
 }
Example #5
0
 /**
  * @param ArticleModel $article
  *
  * @return array
  */
 public function getCategoryIds(ArticleModel $article)
 {
     $adapter = $this->getConnection();
     $select = $adapter->select()->from($this->articleCategoryTable, 'category_id')->where('article_id = ?', (int) $article->getId());
     return $adapter->fetchCol($select);
 }