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

@@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\Controller;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Routing\Annotation\Route;
@@ -25,9 +26,12 @@ class StoredObjectApiController extends ApiController
{
public function __construct(
private readonly Security $security,
private readonly SerializerInterface $serializer,
private readonly EntityManagerInterface $entityManager,
) {}
SerializerInterface $serializer,
ManagerRegistry $managerRegistry,
) {
parent::__construct($serializer, $managerRegistry);
}
/**
* Creates a new stored object.