2018-09-05 15:46:14 +02:00
|
|
|
<?php
|
2018-09-12 22:25:22 +02:00
|
|
|
|
2018-09-05 15:46:14 +02:00
|
|
|
namespace App\Controller;
|
|
|
|
|
2018-09-05 18:17:04 +02:00
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
2018-09-14 16:05:47 +02:00
|
|
|
use App\Entity\AbstractSource;
|
|
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
2018-09-14 18:26:09 +02:00
|
|
|
use App\Source\Generator\StringGenerator;
|
2018-09-05 18:17:04 +02:00
|
|
|
|
2018-09-05 15:46:14 +02:00
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
2018-09-14 16:05:47 +02:00
|
|
|
class SourceController extends AbstractController
|
2018-09-05 15:46:14 +02:00
|
|
|
{
|
2018-09-05 18:17:04 +02:00
|
|
|
public function modify(int $id): Response
|
2018-09-12 22:25:22 +02:00
|
|
|
{
|
|
|
|
}
|
2018-09-05 18:17:04 +02:00
|
|
|
|
2018-09-14 16:05:47 +02:00
|
|
|
/**
|
|
|
|
* @Route("/source/{id}.{_format}", defaults={"_format"="html"})
|
|
|
|
*/
|
|
|
|
public function show(Request $request, int $id): Response
|
2018-09-12 22:25:22 +02:00
|
|
|
{
|
2018-09-14 16:05:47 +02:00
|
|
|
$source = $this->getDoctrine()
|
|
|
|
->getRepository(AbstractSource::class)
|
|
|
|
->find($id);
|
|
|
|
if (!$source) {
|
|
|
|
throw $this->createNotFoundException('No source found for id '.$id);
|
|
|
|
}
|
2018-09-14 18:26:09 +02:00
|
|
|
$templateGenerator = new StringGenerator($request, $source, $this->container->get('twig'));
|
2018-09-14 16:05:47 +02:00
|
|
|
|
2018-09-14 18:26:09 +02:00
|
|
|
return new Response($templateGenerator->render());
|
2018-09-12 22:25:22 +02:00
|
|
|
}
|
2018-09-05 15:46:14 +02:00
|
|
|
}
|