/** * Build menu for plugin * * @param \Knp\Menu\ItemInterface $node * @param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item * * @return \Knp\Menu\ItemInterface */ public function buildMenu(ItemInterface $node, ItemEntity $item) { if ($item->getPath() && $this->fs->exists($item->getPath())) { $node->addChild('Fill folder', ['route' => 'item_folder_filler_fill', 'routeParameters' => ['id' => $item->getId(), 'name' => $item->getUrlName()]])->setLinkAttribute('class', 'icon-label icon-fill'); } }
/** * @param CatalogItem $item * * @return Item|null */ public function findByCatalogItem(CatalogItem $item) { return $this->createQueryBuilder('i')->where('i.item_id = :id')->setParameter(':id', $item->getId())->getQuery()->getOneOrNullResult(); }