src/Application/Controller/HomeController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Application\Controller;
  3. use App\Admin\Document\Category;
  4. use App\Admin\Document\FeedItem;
  5. use App\Admin\Document\Offer;
  6. use App\Admin\Document\Page;
  7. use App\Admin\Document\Project;
  8. use App\Application\Cart\Cart;
  9. use Symfony\Component\HttpFoundation\JsonResponse;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use \Symfony\Component\Routing\Annotation\Route;
  13. class HomeController extends AbstractController
  14. {
  15.     /**
  16.      * @Route("/", name="home")
  17.      */
  18.     public function home(Cart $cartRequest $request): Response
  19.     {
  20.         $page $this->setSeoByUrl('/'$request->getLocale());
  21.         if ($cart->getCounterparty()) {
  22.             return $this->render(
  23.                 'application/home/counterparty-index.html.twig', [
  24.                     'items' => $this->getDocumentRepository(FeedItem::class)->findBy([
  25.                         'active' => true,
  26.                         'types' => ['$ne' => $this->getDirectorTag()->getId()],
  27.                     ], ['date' => 'asc'], 3),
  28.                 ]
  29.             );
  30.         }
  31.         return $this->render(
  32.             'application/home/index.html.twig', [
  33.                 'offers' => $this->getDocumentRepository(Offer::class)->findBy(['active' => true], ['orderNumber' => 'asc'], 4),
  34.                 'projects' => $this->getDocumentRepository(Project::class)->findBy(['active' => true], ['date' => 'desc'])
  35.             ]
  36.         );
  37.     }
  38. }