protected function generateMenu()
 {
     $criteria = new Criteria();
     $criteria->orderBy(['hierarchy' => 'asc']);
     $collection = $this->adminMenuRepository->matching($criteria);
     $elements = $this->filterElements($collection, null);
     $tree = $this->generateTree($collection, $elements);
     return $tree;
 }
Пример #2
4
 public function getMenu()
 {
     $criteria = new Criteria();
     $criteria->orderBy(['hierarchy' => 'asc']);
     $criteria->andWhere($criteria->expr()->eq('parent', null));
     return $this->adminMenuRepository->matching($criteria);
 }
Пример #3
0
 /**
  * Creates new admin menu item
  *
  * @param \SimpleXMLElement $item
  */
 protected function addMenuItem(\SimpleXMLElement $item)
 {
     $em = $this->doctrineHelper->getEntityManager();
     $adminMenuItem = $this->adminMenuRepository->findOneBy(['identifier' => $item->identifier]);
     $parent = $this->adminMenuRepository->findOneBy(['identifier' => $item->parent]);
     if (null === $adminMenuItem) {
         $adminMenuItem = $this->adminMenuFactory->create();
         $adminMenuItem->setCssClass($item->css_class);
         $adminMenuItem->setIdentifier($item->identifier);
         $adminMenuItem->setName($item->name);
         $adminMenuItem->setRouteName($item->route_name);
         $adminMenuItem->setHierarchy($item->hierarchy);
         $adminMenuItem->setParent($parent);
         $em->persist($adminMenuItem);
         $em->flush();
     }
 }