/** * @return \Mirasvit\Blog\Model\Author */ public function initModel() { $model = $this->authorFactory->create(); if ($this->getRequest()->getParam('id')) { $model->load($this->getRequest()->getParam('id')); } $this->registry->register('current_model', $model); return $model; }
/** * @return \Mirasvit\Blog\Model\Author */ protected function initModel() { if ($id = $this->getRequest()->getParam('id')) { $author = $this->authorFactory->create()->load($id); if ($author->getId() > 0) { $this->registry->register('current_blog_author', $author); return $author; } } return false; }
/** * @return $this */ protected function _prepareCollection() { $collection = $this->authorFactory->create()->getCollection(); $this->setCollection($collection); return parent::_prepareCollection(); }