mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-16 10:16:22 +02:00
Refactored code
This commit is contained in:
parent
8b06927936
commit
0e1d5ea024
@ -3,46 +3,10 @@
|
|||||||
namespace Infinito\Controller\API;
|
namespace Infinito\Controller\API;
|
||||||
|
|
||||||
use Infinito\Controller\AbstractController;
|
use Infinito\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*
|
|
||||||
* @todo Implement!
|
|
||||||
*
|
|
||||||
* @see https://de.wikipedia.org/wiki/CRUD
|
|
||||||
*/
|
*/
|
||||||
abstract class AbstractAPIController extends AbstractController
|
abstract class AbstractAPIController extends AbstractController
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* @param Request $request HTTP Method POST with the object attributes as parameters
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
// abstract public function create(Request $request, SecureCRUDFactoryService $crudFactory): Response;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @param Request $request HTTP Method GET
|
|
||||||
* @param int|string $identifier The slug or id of the object
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
// abstract public function read(Request $request, $identifier): Response;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @param Request $request HTTP Method PUT
|
|
||||||
* @param int|string $identifier The slug or id of the object
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
// abstract public function update(Request $request, $identifier): Response;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @param Request $request HTTP Method DELETE with the object attributes as parameters
|
|
||||||
* @param int|string $identifier The slug or id of the object
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
// abstract public function delete(Request $request, $identifier): Response;
|
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,22 @@ final class LayerController extends AbstractAPIController
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const IDENTITY_PARAMETER_KEY = 'identity';
|
public const IDENTITY_PARAMETER_KEY = 'identity';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const LAYER_PARAMETER_KEY = 'layer';
|
public const LAYER_PARAMETER_KEY = 'layer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const LAYER_GET_ROUTE = 'infinito_api_rest_layer_read';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const LAYER_CREATE_ROUTE = 'infinito_api_rest_layer_create';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route(
|
* @Route(
|
||||||
|
@ -13,7 +13,7 @@ final class FixtureSourceFactory implements FixtureSourceFactoryInterface
|
|||||||
/**
|
/**
|
||||||
* @var string Namespace in which the fixture sources are saved
|
* @var string Namespace in which the fixture sources are saved
|
||||||
*/
|
*/
|
||||||
const FIXTURE_SOURCE_NAMESPACE = 'Infinito\Domain\FixtureManagement\FixtureSource';
|
private const FIXTURE_SOURCE_NAMESPACE = 'Infinito\Domain\FixtureManagement\FixtureSource';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|FixtureSourceInterface[]
|
* @return array|FixtureSourceInterface[]
|
||||||
|
@ -16,7 +16,7 @@ final class ParameterFactory implements ParameterFactoryInterface
|
|||||||
/**
|
/**
|
||||||
* @var string Namespace under which the parameters are stored
|
* @var string Namespace under which the parameters are stored
|
||||||
*/
|
*/
|
||||||
const PARAMETER_NAMESPACE = 'Infinito\Domain\ParameterManagement\Parameter';
|
private const PARAMETER_NAMESPACE = 'Infinito\Domain\ParameterManagement\Parameter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ArrayCollection|Collection|ParameterInterface[]
|
* @var ArrayCollection|Collection|ParameterInterface[]
|
||||||
|
@ -25,9 +25,9 @@ final class LayerRepositoryFactoryService implements LayerRepositoryFactoryServi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $layer
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
* @return RepositoryInterface
|
* @see \Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryServiceInterface::getRepository()
|
||||||
*/
|
*/
|
||||||
public function getRepository(string $layer): RepositoryInterface
|
public function getRepository(string $layer): RepositoryInterface
|
||||||
{
|
{
|
||||||
|
@ -28,16 +28,6 @@ use Infinito\Domain\FixtureManagement\FixtureSource\HelpFixtureSource;
|
|||||||
*/
|
*/
|
||||||
class UserMenuSubscriber extends AbstractEntityMenuSubscriber implements EventSubscriberInterface
|
class UserMenuSubscriber extends AbstractEntityMenuSubscriber implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
const LAYER_GET_ROUTE = 'infinito_api_rest_layer_read';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
const LAYER_CREATE_ROUTE = 'infinito_api_rest_layer_create';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var TokenStorageInterface
|
* @var TokenStorageInterface
|
||||||
*/
|
*/
|
||||||
@ -92,7 +82,7 @@ class UserMenuSubscriber extends AbstractEntityMenuSubscriber implements EventSu
|
|||||||
$this->deleteAndAddToItem($menu, $slug);
|
$this->deleteAndAddToItem($menu, $slug);
|
||||||
}
|
}
|
||||||
if ($this->shouldShowFormatSelection($event)) {
|
if ($this->shouldShowFormatSelection($event)) {
|
||||||
$this->generateShowDropdown($menu, $event, self::LAYER_GET_ROUTE);
|
$this->generateShowDropdown($menu, $event, LayerController::LAYER_GET_ROUTE);
|
||||||
}
|
}
|
||||||
$this->generateUserDropdown($menu);
|
$this->generateUserDropdown($menu);
|
||||||
foreach ($this->fixtureSources as $fixtureSource) {
|
foreach ($this->fixtureSources as $fixtureSource) {
|
||||||
@ -121,7 +111,7 @@ class UserMenuSubscriber extends AbstractEntityMenuSubscriber implements EventSu
|
|||||||
private function getSourceItemConfigurationArray(string $identity, string $icon)
|
private function getSourceItemConfigurationArray(string $identity, string $icon)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'route' => self::LAYER_GET_ROUTE,
|
'route' => LayerController::LAYER_GET_ROUTE,
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
LayerController::IDENTITY_PARAMETER_KEY => $identity,
|
LayerController::IDENTITY_PARAMETER_KEY => $identity,
|
||||||
LayerController::FORMAT_PARAMETER_KEY => RESTResponseType::HTML,
|
LayerController::FORMAT_PARAMETER_KEY => RESTResponseType::HTML,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user