src/Controller/Front/DefaultController.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use App\Manager\{HomeManagerAboutManager};
  4. use App\Manager\{CategoryManagerServiceManagerStoreManagerInfoStoreManager};
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class DefaultController extends AbstractController
  9. {
  10.     protected array $locals = [];
  11.     public function __construct()
  12.     {
  13.         $this->locals['menu_active'] = '';
  14.     }
  15.     /**
  16.      * @Route("/", name="home")
  17.      * @Template("front/default/home.html.twig")
  18.      */
  19.     public function home(HomeManager $hmCategoryManager $cmServiceManager $sm): array
  20.     {
  21.         $this->locals['home'] = $hm->find(1);
  22.         $this->locals['categoriesHome'] = $cm->listActiveHome();
  23.         $this->locals['servicesHome'] = $sm->listActiveHome();
  24.         $this->locals['menu_active'] = 'home';
  25.         return $this->locals;
  26.     }
  27.     /**
  28.      * @Route("/nosotros/", name="about")
  29.      * @Template("front/default/about.html.twig")
  30.      */
  31.     public function about(AboutManager $am): array
  32.     {
  33.         $this->locals['home'] = $am->find(1);
  34.         return $this->locals;
  35.     }
  36.     /**
  37.      * @Route("/locales/{slug}/", name="store_detail")
  38.      * @Template("front/default/stores.html.twig")
  39.      */
  40.     public function storesDetail(InfoStoreManager $ismStoreManager $sm$slug): array
  41.     {
  42.         $this->locals['home'] = $ism->find(1);
  43.         $this->locals['stores'] = $sm->listActive();
  44.         $this->locals['detail'] = $sm->findBySlug($slug);
  45.         $this->locals['menu_active'] = 'stores';
  46.         return $this->locals;
  47.     }
  48.     /**
  49.      * @Route("/locales/", name="stores")
  50.      * @Template("front/default/stores.html.twig")
  51.      */
  52.     public function stores(InfoStoreManager $ismStoreManager $sm): array
  53.     {
  54.         $this->locals['home'] = $ism->find(1);
  55.         $this->locals['stores'] = $sm->listActive();
  56.         $this->locals['detail'] = $sm->findBySlug(null);
  57.         $this->locals['menu_active'] = 'stores';
  58.         return $this->locals;
  59.     }
  60. }