/**
  * Add a User
  *
  * @author Jeremie Samson <*****@*****.**>
  *
  * @param User $user
  * @param Post $post
  */
 protected function onSuccess(User $user, Post $post)
 {
     $user->addPost($post);
     $this->em->flush();
 }
예제 #2
0
 /**
  * Set author
  *
  * @param \UserBundle\Entity\User $author
  * @return Post
  */
 public function setAuthor(\UserBundle\Entity\User $author = null)
 {
     $this->author = $author;
     if (null !== $author) {
         $this->setAuthorName($author->getUsername());
         $author->addPost($this);
     }
     return $this;
 }