mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Refactored code
This commit is contained in:
parent
8b06927936
commit
0e1d5ea024
@ -3,46 +3,10 @@
|
||||
namespace Infinito\Controller\API;
|
||||
|
||||
use Infinito\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @todo Implement!
|
||||
*
|
||||
* @see https://de.wikipedia.org/wiki/CRUD
|
||||
*/
|
||||
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
|
||||
*/
|
||||
const IDENTITY_PARAMETER_KEY = 'identity';
|
||||
public const IDENTITY_PARAMETER_KEY = 'identity';
|
||||
|
||||
/**
|
||||
* @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(
|
||||
|
@ -13,7 +13,7 @@ final class FixtureSourceFactory implements FixtureSourceFactoryInterface
|
||||
/**
|
||||
* @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[]
|
||||
|
@ -16,7 +16,7 @@ final class ParameterFactory implements ParameterFactoryInterface
|
||||
/**
|
||||
* @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[]
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -28,16 +28,6 @@ use Infinito\Domain\FixtureManagement\FixtureSource\HelpFixtureSource;
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@ -92,7 +82,7 @@ class UserMenuSubscriber extends AbstractEntityMenuSubscriber implements EventSu
|
||||
$this->deleteAndAddToItem($menu, $slug);
|
||||
}
|
||||
if ($this->shouldShowFormatSelection($event)) {
|
||||
$this->generateShowDropdown($menu, $event, self::LAYER_GET_ROUTE);
|
||||
$this->generateShowDropdown($menu, $event, LayerController::LAYER_GET_ROUTE);
|
||||
}
|
||||
$this->generateUserDropdown($menu);
|
||||
foreach ($this->fixtureSources as $fixtureSource) {
|
||||
@ -121,7 +111,7 @@ class UserMenuSubscriber extends AbstractEntityMenuSubscriber implements EventSu
|
||||
private function getSourceItemConfigurationArray(string $identity, string $icon)
|
||||
{
|
||||
return [
|
||||
'route' => self::LAYER_GET_ROUTE,
|
||||
'route' => LayerController::LAYER_GET_ROUTE,
|
||||
'routeParameters' => [
|
||||
LayerController::IDENTITY_PARAMETER_KEY => $identity,
|
||||
LayerController::FORMAT_PARAMETER_KEY => RESTResponseType::HTML,
|
||||
|
Loading…
Reference in New Issue
Block a user