コード例 #1
0
 /**
  * A command to setup a blog
  *
  * With this command you can kickstart a new blog.
  *
  * @param string $blogTitle the name of the blog to create
  * @param boolean $reset set this flag to remove all previously created blogs and posts
  * @return void
  */
 public function setupCommand($blogTitle, $reset = FALSE)
 {
     if ($reset) {
         $this->blogRepository->removeAll();
         $this->postRepository->removeAll();
     }
     $blog = new Blog($blogTitle);
     $blog->setDescription('A blog about Foo, Bar and Baz.');
     $this->blogRepository->add($blog);
     $post = new Post();
     $post->setBlog($blog);
     $post->setAuthor('John Doe');
     $post->setSubject('Example Post');
     $post->setContent('Lorem ipsum dolor sit amet, consectetur adipisicing elit.' . chr(10) . 'Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
     $this->postRepository->add($post);
     $this->outputLine('Successfully created a blog "%s"', [$blogTitle]);
 }
コード例 #2
0
ファイル: PostController.php プロジェクト: neos/Acme.Blog
 /**
  * Removes a post from the database
  *
  * @Flow\IgnoreValidation("$post")
  * @param Post $post
  * @return void
  */
 public function deleteAction(Post $post)
 {
     $this->postRepository->remove($post);
     $this->addFlashMessage('Deleted a post.');
     $this->redirect('index');
 }