コード例 #1
0
 /**
  * @param $id
  */
 public function actionPosts($id)
 {
     if ($tag = $this->tagFacade->getOne($id)) {
         $this->template->tag = $tag;
         $this->posts = $tag->getPosts()->toArray();
         if (!count($this->posts)) {
             $this->setView('none');
         }
     } else {
         $this->setView('notFound');
     }
 }
コード例 #2
0
ファイル: PostForm.php プロジェクト: flame-cms/post-bundle
 /**
  * @param PostForm $form
  */
 public function formSubmitted(PostForm $form)
 {
     $values = $form->getValues();
     $values->category = $this->categoryFacade->getOne($values->category);
     $tags = array();
     if (count($values->tags)) {
         foreach ($values->tags as $tagId) {
             $tags[] = $this->tagFacade->getOne($tagId);
         }
     }
     $values->tags = $tags;
     try {
         $this->postManager->update($values);
         $form->presenter->flashMessage('Post management was successful', 'success');
     } catch (\Nette\InvalidArgumentException $ex) {
         $form->addError($ex->getMessage());
     }
 }
コード例 #3
0
 /**
  * @param null $id
  */
 public function actionUpdate($id = null)
 {
     $this->tag = $this->tagFacade->getOne($id);
     $this->template->tag = $this->tag;
 }