示例#1
0
 /**
  *
  * @return Response
  * @route("/remove/{class}/{category}", name="categories_remove")
  * @paramConverter("category", class="FunctionalAnalysisBundle:Category")
  */
 public function removeAction(Category $category, $class)
 {
     if ($category->isRemovable()) {
         $em = $this->getDoctrine()->getManager();
         $em->remove($category);
         $em->flush();
     }
     return $this->redirect($this->generateUrl('categories_show_all', array('class' => $class)));
 }
 public function TraceFilter(Category $category)
 {
     $parents = $category->getParentRecursive();
     $result = '<div class="ui breadcrumb">';
     /** @var Category $parent */
     foreach ($parents as $parent) {
         $result = $result . '<a class="section" href="' . $this->generator->generate('categories_show', array('category' => $parent->getId())) . '">' . $parent->getName() . '</a><i class="right chevron icon divider"></i>';
     }
     $result = $result . '<a class="active section">' . $category->getName() . '</a>';
     return $result . '</div>';
 }
示例#3
0
 /**
  * @param Category $category
  * @return \Doctrine\ORM\QueryBuilder
  *
  * Find all category exepts the childs (recusrive) of $category
  */
 public function findWithoutChilds(Category $category)
 {
     $idArray = [];
     $all = $this->findAll();
     foreach ($all as $one) {
         $idArray[$one->getId()] = $one->getId();
     }
     $childs = $category->getChildsRecursive();
     foreach ($childs as $child) {
         unset($idArray[$child->getId()]);
     }
     unset($idArray[$category->getId()]);
     $query = $this->createQueryBuilder('c')->where('c.id IN (:id)')->setParameter('id', $idArray);
     return $query;
 }
示例#4
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->stakeholders = new \Doctrine\Common\Collections\ArrayCollection();
 }
示例#5
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->capacities = new \Doctrine\Common\Collections\ArrayCollection();
 }