/**
  * 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']);
 }
Example #2
0
 /**
  * @param Category $category
  */
 public function addCategoryCollection(Category $category)
 {
     $category->addPost($this);
     // synchronously updating inverse side
     $this->categories[] = $category;
 }