Implemented view for node

This commit is contained in:
Kevin Frantz
2018-09-20 16:03:00 +02:00
parent 1915c77d8c
commit ee1cef71b7
7 changed files with 117 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ use FOS\RestBundle\Controller\FOSRestController;
use App\Entity\SourceInterface;
use App\Creator\Factory\Template\Source\SourceTemplateFormFactory;
use App\Creator\Factory\Form\Source\SourceFormFactory;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* @todo IMPLEMENT SECURITY!
@@ -50,6 +51,16 @@ class SourceController extends FOSRestController
]);
}
/**
* @Route("/source/{id}/node.{_format}", defaults={"_format"="html"})
*/
public function node(Request $request, int $id): RedirectResponse
{
$source = $this->loadSource($request, $id);
return $this->redirectToRoute('app_node_show', ['id' => $source->getNode()->getId()]);
}
private function loadSource(Request $request, int $id): SourceInterface
{
$source = $this->getDoctrine()