<?php
namespace App\Controller\Support;
use App\Entity\DeliveryPoint;
use App\Entity\PackagePostman;
use App\Repository\DeliveryPointRepository;
use App\Repository\PackagePostmanRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use function count;
class DefaultController extends AbstractController
{
public function index(EntityManagerInterface $entityManager): Response
{
/** @var PackagePostmanRepository $packagePostmanRepository */
$packagePostmanRepository = $entityManager->getRepository(PackagePostman::class);
$errorPackageCount = $packagePostmanRepository->getErrorPackagesCount();
/** @var DeliveryPointRepository $deliveryPointRepository */
$deliveryPointRepository = $entityManager->getRepository(DeliveryPoint::class);
$deficientPointCount = count($deliveryPointRepository->getDeficientPoints());
return $this->render('Support/index.html.twig', [
'errorPackageCount' => $errorPackageCount,
'deficientPointCount' => $deficientPointCount
]);
}
/**
* Zobrazí robots.txt na supportu
* Na supportu nepotřebujeme žádné roboty
* @return Response
*/
public function robotsTxtFile(): Response
{
$response = new Response(
implode("\n", [
'User-agent: *',
'User-agent: Googlebot',
'User-agent: AdsBot-Google',
'Disallow: /',
]),
200
);
$response->headers->set('Content-Type', 'text/plain; charset=utf-8');
return $response;
}
}