helperData = $helperData; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } /** * Constructor */ protected function _construct() { $this->_init(ResourceModel\Author::class); } /** * @param $name * * @return DataObject */ public function getAuthorByName($name) { return $this->getCollection()->addFieldToFilter('name', $name)->getFirstItem(); } /** * @return array */ public function getIdentities() { return [self::CACHE_TAG . '_' . $this->getId()]; } /** * @return string */ public function getUrl() { return $this->helperData->getBlogUrl($this, Data::TYPE_AUTHOR); } /** * @return bool */ public function hasPost() { try { return (bool)count($this->_getResource()->getPostIds($this)); } catch (LocalizedException $exception) { return false; } } }