src/Controller/FooterController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Taxonomy\Taxon;
  4. use Doctrine\Persistence\ManagerRegistry;
  5. use Sylius\Component\Channel\Context\ChannelContextInterface;
  6. use Sylius\Component\Channel\Model\ChannelInterface;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Response;
  9. /**
  10.  * @property ManagerRegistry $manager
  11.  */
  12. class FooterController extends AbstractController
  13. {
  14.     private ChannelInterface $channel;
  15.     public function __construct(ManagerRegistry $registryChannelContextInterface $channelContext)
  16.     {
  17.         $this->manager $registry;
  18.         $this->channel $channelContext->getChannel();
  19.     }
  20.     public function getFooterTaxonAction(): Response
  21.     {
  22.         if (!$root $this->channel->getMenuTaxon()) {
  23.             $root $this->manager->getRepository(Taxon::class)->findOneBy(['parent' => NULL]);
  24.         }
  25.         return $this->render('footer/_taxons.html.twig', [
  26.             'taxons' => $root->getEnabledChildren()
  27.         ]);
  28.     }
  29. }