infinito/application/src/Controller/DefaultController.php

53 lines
1.6 KiB
PHP
Raw Normal View History

2018-09-05 09:11:08 +02:00
<?php
2018-09-12 22:25:22 +02:00
2018-09-05 09:11:08 +02:00
namespace App\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
2018-11-23 23:22:17 +01:00
use App\DBAL\Types\SystemSlugType;
use App\Entity\Source\AbstractSource;
2019-01-03 22:56:31 +01:00
use App\Entity\Meta\Right;
2019-01-05 17:27:40 +01:00
use App\DBAL\Types\Meta\Right\LayerType;
use App\DBAL\Types\Meta\Right\CRUDType;
2019-01-04 20:41:37 +01:00
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Source\PureSource;
use App\Domain\ResponseManagement\SourceRESTResponseManager;
2018-09-05 09:11:08 +02:00
/**
* This controller offers the standart routes for the template.
*
2018-09-05 09:11:08 +02:00
* @author kevinfrantz
*/
2019-01-04 21:28:21 +01:00
final class DefaultController extends AbstractEntityController
2018-09-05 09:11:08 +02:00
{
2018-09-05 18:11:35 +02:00
/**
2018-11-23 23:22:17 +01:00
* @todo Optimize function!
* @Route("/imprint.{_format}", defaults={"_format"="json"}, name="imprint")
2018-09-05 18:11:35 +02:00
*/
2019-01-04 20:41:37 +01:00
public function imprint(EntityManagerInterface $entityManager): Response
2018-09-05 09:11:08 +02:00
{
$requestedSource = new PureSource();
2019-01-03 22:56:31 +01:00
$requestedSource->setSlug(SystemSlugType::IMPRINT);
$requestedRight = new Right();
$requestedRight->setSource($requestedSource);
$requestedRight->setLayer(LayerType::SOURCE);
2019-01-05 17:27:40 +01:00
$requestedRight->setType(CRUDType::READ);
$sourceResponseManager = new SourceRESTResponseManager($this->getUser(), $entityManager, $requestedRight, $this->getViewHandler());
2018-11-23 23:22:17 +01:00
return $sourceResponseManager->getResponse();
2018-09-05 09:11:08 +02:00
}
2018-09-12 22:25:22 +02:00
2018-09-05 09:11:08 +02:00
/**
* @Route("/", name="homepage")
*/
public function homepage(): Response
{
2018-09-12 22:25:22 +02:00
return $this->render('standard/homepage.html.twig');
2018-09-05 09:11:08 +02:00
}
2018-11-23 23:22:17 +01:00
protected function setEntityName(): void
{
$this->entityName = AbstractSource::class;
}
2018-09-05 09:11:08 +02:00
}