mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Correct injection of services
This commit is contained in:
parent
382f20c6ad
commit
f4ed7e4254
@ -27,10 +27,7 @@ class StoredObjectApiController extends ApiController
|
||||
public function __construct(
|
||||
private readonly Security $security,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
SerializerInterface $serializer,
|
||||
ManagerRegistry $managerRegistry,
|
||||
) {
|
||||
parent::__construct($serializer, $managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,6 +28,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Contracts\Service\Attribute\Required;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
abstract class AbstractCRUDController extends AbstractController
|
||||
@ -39,10 +40,23 @@ abstract class AbstractCRUDController extends AbstractController
|
||||
*/
|
||||
protected array $crudConfig = [];
|
||||
|
||||
public function __construct(protected readonly SerializerInterface $serializer, protected readonly ManagerRegistry $managerRegistry)
|
||||
protected ManagerRegistry $managerRegistry;
|
||||
protected SerializerInterface $serializer;
|
||||
|
||||
#[Required]
|
||||
public function setSerializer(SerializerInterface $serializer): void
|
||||
{
|
||||
$this->serializer = $serializer;
|
||||
}
|
||||
|
||||
#[Required]
|
||||
public function setManagerRegistry(ManagerRegistry $managerRegistry): void
|
||||
{
|
||||
$this->managerRegistry = $managerRegistry;
|
||||
}
|
||||
|
||||
// public function __construct(protected readonly SerializerInterface $serializer, protected readonly ManagerRegistry $managerRegistry) {}
|
||||
|
||||
/**
|
||||
* get the role given from the config.
|
||||
*/
|
||||
|
@ -24,11 +24,6 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
|
||||
class ApiController extends AbstractCRUDController
|
||||
{
|
||||
public function __construct(SerializerInterface $serializer, ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($serializer, $managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Base method for handling api action.
|
||||
*
|
||||
|
@ -23,13 +23,6 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class AddressApiController extends ApiController
|
||||
{
|
||||
public function __construct(
|
||||
SerializerInterface $serializer,
|
||||
ManagerRegistry $managerRegistry,
|
||||
) {
|
||||
parent::__construct($serializer, $managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate an existing address.
|
||||
*/
|
||||
|
@ -55,10 +55,7 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
private readonly Registry $registry,
|
||||
private readonly ValidatorInterface $validator,
|
||||
private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository,
|
||||
ManagerRegistry $managerRegistry,
|
||||
SerializerInterface $serializer,
|
||||
) {
|
||||
parent::__construct($serializer, $managerRegistry);
|
||||
}
|
||||
|
||||
public function commentApi($id, Request $request, string $_format): Response
|
||||
|
@ -37,10 +37,7 @@ class HouseholdApiController extends ApiController
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
private readonly HouseholdRepository $householdRepository,
|
||||
private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository,
|
||||
ManagerRegistry $managerRegistry,
|
||||
SerializerInterface $serializer,
|
||||
) {
|
||||
parent::__construct($serializer, $managerRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,11 +47,8 @@ class HouseholdMemberController extends ApiController
|
||||
private readonly HouseholdRepository $householdRepository,
|
||||
private readonly Security $security,
|
||||
private readonly PositionRepository $positionRepository,
|
||||
ManagerRegistry $managerRegistry,
|
||||
SerializerInterface $serializer,
|
||||
protected ParameterBagInterface $parameterBag,
|
||||
) {
|
||||
parent::__construct($serializer, $managerRegistry);
|
||||
$this->household_fields_visibility = $parameterBag->get('chill_person.household_fields');
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class PersonApiController extends ApiController
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user