mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Add explicit controller definition requirement for APIs
Updated API creation to require an explicit controller definition. This change has been reflected in the ChillMainExtension and ChillPersonExtension files. Also, it has introduced a new exception, the InvalidCrudConfiguration, which will be thrown when a new API or CRUD is created without this explicit controller definition.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
|
||||
class AccompanyingPeriodCommentApiController extends ApiController {}
|
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
|
||||
class AccompanyingPeriodResourceApiController extends ApiController {}
|
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
|
||||
class RelationApiController extends ApiController {}
|
@@ -17,11 +17,10 @@ use Chill\PersonBundle\Repository\Relationships\RelationshipRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class RelationshipApiController extends ApiController
|
||||
{
|
||||
public function __construct(private readonly ValidatorInterface $validator, private readonly RelationshipRepository $repository) {}
|
||||
public function __construct(private readonly RelationshipRepository $repository) {}
|
||||
|
||||
/**
|
||||
* @ParamConverter("person", options={"id": "person_id"})
|
||||
|
@@ -13,7 +13,10 @@ namespace Chill\PersonBundle\DependencyInjection;
|
||||
|
||||
use Chill\MainBundle\DependencyInjection\MissingBundleException;
|
||||
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
|
||||
use Chill\PersonBundle\Controller\AccompanyingPeriodCommentApiController;
|
||||
use Chill\PersonBundle\Controller\AccompanyingPeriodResourceApiController;
|
||||
use Chill\PersonBundle\Controller\HouseholdCompositionTypeApiController;
|
||||
use Chill\PersonBundle\Controller\RelationApiController;
|
||||
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodCommentVoter;
|
||||
@@ -537,6 +540,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
],
|
||||
[
|
||||
'class' => AccompanyingPeriod\Comment::class,
|
||||
'controller' => AccompanyingPeriodCommentApiController::class,
|
||||
'name' => 'accompanying_period_comment',
|
||||
'base_path' => '/api/1.0/person/accompanying-period/comment',
|
||||
'base_role' => 'ROLE_USER',
|
||||
@@ -556,6 +560,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
],
|
||||
[
|
||||
'class' => AccompanyingPeriod\Resource::class,
|
||||
'controller' => AccompanyingPeriodResourceApiController::class,
|
||||
'name' => 'accompanying_period_resource',
|
||||
'base_path' => '/api/1.0/person/accompanying-period/resource',
|
||||
'base_role' => 'ROLE_USER',
|
||||
@@ -874,6 +879,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
],
|
||||
[
|
||||
'class' => \Chill\PersonBundle\Entity\Relationships\Relation::class,
|
||||
'controller' => RelationApiController::class,
|
||||
'name' => 'relations',
|
||||
'base_path' => '/api/1.0/relations/relation',
|
||||
'base_role' => 'ROLE_USER',
|
||||
|
Reference in New Issue
Block a user