fixes after merge of master into upgrade-sf4

This commit is contained in:
2024-02-12 22:31:16 +01:00
parent 37af488f69
commit f889d67e94
664 changed files with 795 additions and 1980 deletions

View File

@@ -23,8 +23,6 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
class ApiController extends AbstractCRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Base method for handling api action.
*
@@ -82,8 +80,8 @@ class ApiController extends AbstractCRUDController
return $response;
}
$this->managerRegistry->getManager()->remove($entity);
$this->managerRegistry->getManager()->flush();
$this->getManagerRegistry()->getManager()->remove($entity);
$this->getManagerRegistry()->getManager()->flush();
$response = $this->onAfterFlush($action, $request, $_format, $entity, $errors);
@@ -155,7 +153,7 @@ class ApiController extends AbstractCRUDController
return $response;
}
$this->managerRegistry->getManagerForClass($this->getEntityClass())->flush();
$this->getManagerRegistry()->getManagerForClass($this->getEntityClass())->flush();
$response = $this->onAfterFlush($action, $request, $_format, $entity, $errors);
@@ -271,10 +269,10 @@ class ApiController extends AbstractCRUDController
}
if ($forcePersist && Request::METHOD_POST === $request->getMethod()) {
$this->managerRegistry->getManager()->persist($postedData);
$this->getManagerRegistry()->getManager()->persist($postedData);
}
$this->managerRegistry->getManager()->flush();
$this->getManagerRegistry()->getManager()->flush();
$response = $this->onAfterFlush($action, $request, $_format, $entity, $errors, [$postedData]);
@@ -375,7 +373,7 @@ class ApiController extends AbstractCRUDController
try {
$entity = $this->deserialize($action, $request, $_format, $entity);
} catch (NotEncodableValueException $e) {
throw new BadRequestHttpException('invalid json', 400, $e);
throw new BadRequestHttpException('invalid json', $e, 400);
}
$errors = $this->validate($action, $request, $_format, $entity);
@@ -405,8 +403,8 @@ class ApiController extends AbstractCRUDController
return $response;
}
$this->managerRegistry->getManager()->persist($entity);
$this->managerRegistry->getManager()->flush();
$this->getManagerRegistry()->getManager()->persist($entity);
$this->getManagerRegistry()->getManager()->flush();
$response = $this->onAfterFlush($action, $request, $_format, $entity, $errors);