<?php
namespace App\Application\Controller;
use App\Admin\Document\Category;
use App\Admin\Document\FeedItem;
use App\Admin\Document\Offer;
use App\Admin\Document\Page;
use App\Admin\Document\Project;
use App\Application\Cart\Cart;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use \Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
/**
* @Route("/", name="home")
*/
public function home(Cart $cart, Request $request): Response
{
$page = $this->setSeoByUrl('/', $request->getLocale());
if ($cart->getCounterparty()) {
return $this->render(
'application/home/counterparty-index.html.twig', [
'items' => $this->getDocumentRepository(FeedItem::class)->findBy([
'active' => true,
'types' => ['$ne' => $this->getDirectorTag()->getId()],
], ['date' => 'asc'], 3),
]
);
}
return $this->render(
'application/home/index.html.twig', [
'offers' => $this->getDocumentRepository(Offer::class)->findBy(['active' => true], ['orderNumber' => 'asc'], 4),
'projects' => $this->getDocumentRepository(Project::class)->findBy(['active' => true], ['date' => 'desc'])
]
);
}
}