/** * Add category * * @param Manhattan\Bundle\PostsBundle\Entity\Category $category * @return Post */ public function setCategory(Category $category = null) { $category->addPost($this); $this->category = $category; return $this; }