mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-09 23:09:43 +00:00
fixes after merge of master into upgrade-sf4
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user