Ejemplo n.º 1
0
 /**
  * @param  \Doctrine\Common\Persistence\ObjectManager                                   $manager
  * @param  string                                                                       $name
  * @param  string                                                                       $description
  * @param  \ServerGrove\KbBundle\Document\Category|\Doctrine\ODM\PHPCR\Document\Generic $parent
  * @param  bool                                                                         $private
  * @return \ServerGrove\KbBundle\Document\Category
  */
 private function addCategory(ObjectManager $manager, $name, $description, $parent, $private = false)
 {
     $category = new Category();
     $category->setParent($parent);
     $category->setName($name);
     $category->setDescription($description);
     $category->setVisibility($private ? Category::VISIBILITY_PRIVATE : Category::VISIBILITY_PUBLIC);
     $manager->persist($category);
     $manager->bindTranslation($category, 'en');
     $manager->flush($category);
     return $category;
 }