mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Applied CS fixer
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\EntityInterface;
|
||||
@@ -6,9 +7,7 @@ use FOS\RestBundle\Controller\FOSRestController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
abstract class AbstractEntityController extends FOSRestController
|
||||
{
|
||||
@@ -16,13 +15,14 @@ abstract class AbstractEntityController extends FOSRestController
|
||||
* @var string
|
||||
*/
|
||||
protected $entityName;
|
||||
|
||||
public function __construct(){
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setEntityName();
|
||||
}
|
||||
|
||||
abstract protected function setEntityName():void;
|
||||
|
||||
|
||||
abstract protected function setEntityName(): void;
|
||||
|
||||
protected function loadEntityById(int $id): EntityInterface
|
||||
{
|
||||
$entity = $this->getDoctrine()
|
||||
@@ -31,13 +31,14 @@ abstract class AbstractEntityController extends FOSRestController
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('No entity found for id '.$id);
|
||||
}
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
|
||||
protected function redirectToRouteById(string $route, int $id): RedirectResponse
|
||||
{
|
||||
return $this->redirectToRoute($route, [
|
||||
'id' => $id
|
||||
'id' => $id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user