Inject managerRegistry and serializerInterface directly into controllers

This commit is contained in:
2025-05-28 12:04:27 +02:00
parent cc20e8896f
commit abfdf2ec6d
7 changed files with 70 additions and 25 deletions

View File

@@ -13,14 +13,21 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Entity\Address;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
class AddressApiController extends ApiController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
public function __construct(
SerializerInterface $serializer,
ManagerRegistry $managerRegistry,
) {
parent::__construct($serializer, $managerRegistry);
}
/**
* Duplicate an existing address.