/** * get options as key value pair * * @return array */ public function toOptionArray() { if (is_null($this->options)) { $this->options = $this->countryCollectionFactory->create()->toOptionArray(' '); } return $this->options; }
/** * @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()]); }
/** * @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); }
/** * @param Author $author * @return $this */ protected function doTheAction(Author $author) { $author->setIsActive($this->isActive); $author->save(); return $this; }
/** * 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; }
/** * @param $author * @return $this */ protected function doTheAction(Author $author) { $author->delete(); return $this; }