Example #1
0
 /**
  * @return \Mirasvit\Blog\Model\Post
  */
 public function initModel()
 {
     $model = $this->postFactory->create();
     if ($this->getRequest()->getParam('id')) {
         $model->load($this->getRequest()->getParam('id'));
     }
     $this->registry->register('current_model', $model);
     return $model;
 }
Example #2
0
 /**
  * @return \Mirasvit\Blog\Model\Post
  */
 protected function initModel()
 {
     if ($id = $this->getRequest()->getParam('id')) {
         $post = $this->postFactory->create()->load($id);
         if ($post->getId() > 0) {
             $this->registry->register('current_blog_post', $post);
             return $post;
         }
     }
 }