src/Controller/Frontend/FooterController.php line 48

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Frontend;
  3. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  4. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use Nzo\UrlEncryptorBundle\Annotations\ParamDecryptor;
  8. use Nzo\UrlEncryptorBundle\Annotations\ParamEncryptor;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. use Symfony\Component\Security\Core\Security;
  11. use App\Service\HelperService;
  12. use Symfony\Component\String\Slugger\SluggerInterface;
  13. use Nzo\UrlEncryptorBundle\Encryptor\Encryptor;
  14. use Symfony\Component\HttpFoundation\RequestStack;
  15. class FooterController extends AbstractController
  16. {
  17.     private $requestStack;
  18.     public function __construct(RequestStack $requestStack)
  19.     {
  20.         $this->requestStack $requestStack;
  21.     }
  22.     
  23.     
  24.     
  25.     public function footerAction(Request $request)
  26.     {
  27.         $masterRequest $this->requestStack->getMainRequest();         
  28.         $path $masterRequest->getPathInfo();  
  29.         $slugArray explode("/"$path);
  30.         $slug "";
  31.         if(count($slugArray) > 0)
  32.         {
  33.             $slug $slugArray[1];
  34.         }
  35.         $em $this->getDoctrine()->getManager();
  36.         $client     $em->getRepository(\App\Entity\Client::class)->findOneBy(array('slug' => $slug));
  37.         $webSetting $em->getRepository(\App\Entity\WebSetting::class)->findOneBy(array("Client" => $client));        
  38.         $brands     $em->getRepository(\App\Entity\Brand::class)->findBy(array('is_active' => 1'Client' => $client));
  39.         $policies   $em->getRepository(\App\Entity\Policy::class)->findBy(array('is_active' => 1'Client' => $client));
  40.         
  41.         return $this->render('Frontend/footer.html.twig',
  42.         array(
  43.             
  44.             'brands'          => $brands,
  45.             'policies'        => $policies,
  46.             'brand'           => '',
  47.             'category'        => '',
  48.             'information'     => $client,
  49.             'webSetting'      => $webSetting,
  50.             'slug'            => $slug
  51.         ));
  52.     }
  53.     /**     
  54.      * @Route("/{slug}/policies", name="footer_policy")
  55.      */
  56.     public function policyAction (Request $request$slug)
  57.     {   
  58.         $policyId $request->get('id');
  59.         $em     $this->getDoctrine()->getManager();
  60.         $client $em->getRepository(\App\Entity\Client::class)->findOneBy(array("slug" => $slug));                
  61.         $policy $em->getRepository(\App\Entity\Policy::class)->findOneBy(array('policyId' => $policyId));
  62.         
  63.         if($policy)
  64.         {
  65.             $name     $policy->getName();
  66.             $lastDate $policy->getCreatedAt()->format('M-Y');
  67.             $content  $policy->getContentText();
  68.         }
  69.         return $this->render('Frontend/Footer/index.html.twig',array(
  70.             'name'               => $name,
  71.             'lastDate'           => $lastDate,
  72.             'content'           => $content,
  73.             'productCategory' => '',
  74.             'pager_limit'     => 12,
  75.             'globalSearch'    => '',
  76.             'brand'           => '',
  77.             'category'        => '',
  78.             'slug'            => $slug            
  79.         ));
  80.     }
  81.    
  82. }