Esempio n. 1
0
 public function getMenu()
 {
     $criteria = new Criteria();
     $criteria->orderBy(['hierarchy' => 'asc']);
     $criteria->andWhere($criteria->expr()->eq('parent', null));
     return $this->adminMenuRepository->matching($criteria);
 }
Esempio n. 2
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();
     }
 }