コード例 #1
0
 /**
  * Create a category form.
  *
  * @param Category $category
  *
  * @return Form
  *
  */
 public function createForm(Category $category)
 {
     $route = $this->router->generate('prh_blog_category_create');
     if ($category->getId()) {
         $route = $this->router->generate('prh_blog_category_update', ['id' => $category->getId()]);
     }
     return $this->formFactory->create(new CategoryType(), $category, ['action' => $route, 'method' => 'POST']);
 }
コード例 #2
0
ファイル: Post.php プロジェクト: prevueltas/blog-bundle
 /**
  * @param Category $category
  */
 public function addCategoryCollection(Category $category)
 {
     $category->addPost($this);
     // synchronously updating inverse side
     $this->categories[] = $category;
 }