示例#1
0
 /**
  * Checks whether the given blog is valid
  *
  * @param Tx_BlogExample_Domain_Model_Blog $blog The blog
  * @return boolean TRUE if blog could be validated, otherwise FALSE
  */
 public function isValid($blog)
 {
     if (strtolower($blog->getTitle()) === 'extbase') {
         $this->addError(Tx_Extbase_Utility_Localization::translate('error.Blog.invalidTitle', 'BlogExample'), 1297418974);
         return FALSE;
     }
     return TRUE;
 }
示例#2
0
 /**
  * Creates a new post
  *
  * @param Tx_BlogExample_Domain_Model_Blog $blog The blog the post belogns to
  * @param Tx_BlogExample_Domain_Model_Post $newBlog A fresh Blog object which has not yet been added to the repository
  * @return void
  */
 public function createAction(Tx_BlogExample_Domain_Model_Blog $blog, Tx_BlogExample_Domain_Model_Post $newPost)
 {
     // TODO access protection
     $blog->addPost($newPost);
     $newPost->setBlog($blog);
     $this->addFlashMessage('created');
     $this->redirect('index', NULL, NULL, array('blog' => $blog));
 }