Beispiel #1
0
 /**
  * @param Author $author
  * @return string
  */
 public function getAuthorUrl(Author $author)
 {
     if ($urlKey = $author->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('sample_news/author/view', ['id' => $author->getId()]);
 }
Beispiel #2
0
 /**
  * @param AuthorModel $author
  *
  * @return array
  */
 public function getCategoryIds(AuthorModel $author)
 {
     $adapter = $this->getConnection();
     $select = $adapter->select()->from($this->authorCategoryTable, 'category_id')->where('author_id = ?', (int) $author->getId());
     return $adapter->fetchCol($select);
 }
Beispiel #3
0
 /**
  * Add author id to error message
  *
  * @param Author $author
  * @param string $errorText
  * @return string
  */
 protected function getErrorWithAuthorId(Author $author, $errorText)
 {
     return '[Author ID: ' . $author->getId() . '] ' . $errorText;
 }