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;
|
2019-01-04 22:09:05 +01:00
|
|
|
use App\Entity\Source\PureSource;
|
2019-01-05 11:37:36 +01:00
|
|
|
use App\Domain\ResponseManagement\SourceRESTResponseManager;
|
2018-09-05 09:11:08 +02:00
|
|
|
|
|
|
|
/**
|
2019-01-01 00:16:43 +01: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!
|
2019-01-05 11:37:36 +01:00
|
|
|
* @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
|
|
|
{
|
2019-01-04 22:09:05 +01: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);
|
2019-01-05 11:37:36 +01:00
|
|
|
$sourceResponseManager = new SourceRESTResponseManager($this->getUser(), $entityManager, $requestedRight, $this->getViewHandler());
|
2018-11-23 23:22:17 +01:00
|
|
|
|
2019-01-05 11:37:36 +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
|
|
|
}
|