bootstrap api and apply on accompanying period

This commit is contained in:
2021-05-06 00:14:36 +02:00
parent f02e33fda7
commit 07e0692783
16 changed files with 235 additions and 257 deletions

View File

@@ -33,6 +33,7 @@ class AbstractCRUDController extends AbstractController
}
/**
* Get the complete FQDN of the class
*
* @return string the complete fqdn of the class
*/
@@ -42,7 +43,7 @@ class AbstractCRUDController extends AbstractController
}
/**
*
* called on post fetch entity
*/
protected function onPostFetchEntity(string $action, Request $request, $entity, $_format): ?Response
{
@@ -50,14 +51,13 @@ class AbstractCRUDController extends AbstractController
}
/**
*
* Called on post check ACL
*/
protected function onPostCheckACL(string $action, Request $request, $entity, $_format): ?Response
{
return null;
}
/**
* check the acl. Called by every action.
*
@@ -74,12 +74,20 @@ class AbstractCRUDController extends AbstractController
$this->denyAccessUnlessGranted($this->getRoleFor($action, $request, $entity, $_format), $entity);
}
/**
*
* @return string the crud name
*/
protected function getCrudName(): string
{
return $this->crudConfig['name'];
}
protected function getActionConfig(string $action)
{
return $this->crudConfig['actions'][$action];
}
/**
* Set the crud configuration
*
@@ -87,7 +95,6 @@ class AbstractCRUDController extends AbstractController
*/
public function setCrudConfig(array $config): void
{
dump($config);
$this->crudConfig = $config;
}

View File

@@ -5,6 +5,7 @@ namespace Chill\MainBundle\CRUD\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
class ApiController extends AbstractCRUDController
{
@@ -114,22 +115,6 @@ class ApiController extends AbstractCRUDController
protected function getSerializer(): SerializerInterface
{
return $this->get(SerializerInterface::class);
return $this->get('serializer');
}
/**
* Defined the services necessary for this controller
*
* @return array
*/
public static function getSubscribedServices(): array
{
return \array_merge(
parent::getSubscribedServices(),
[
SerializerInterface::class => SerializerInterface::class,
]
);
}
}