Replace methods with injected services

This commit is contained in:
2025-06-03 14:50:58 +02:00
parent 52c3c0a565
commit 9875f49374
3 changed files with 11 additions and 11 deletions

View File

@@ -154,7 +154,7 @@ class ApiController extends AbstractCRUDController
return $response;
}
$this->getManagerRegistry()->getManagerForClass($this->getEntityClass())->flush();
$this->managerRegistry->getManagerForClass($this->getEntityClass())->flush();
$response = $this->onAfterFlush($action, $request, $_format, $entity, $errors);
@@ -270,10 +270,10 @@ class ApiController extends AbstractCRUDController
}
if ($forcePersist && Request::METHOD_POST === $request->getMethod()) {
$this->getManagerRegistry()->getManager()->persist($postedData);
$this->managerRegistry->getManager()->persist($postedData);
}
$this->getManagerRegistry()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
$response = $this->onAfterFlush($action, $request, $_format, $entity, $errors, [$postedData]);
@@ -404,8 +404,8 @@ class ApiController extends AbstractCRUDController
return $response;
}
$this->getManagerRegistry()->getManager()->persist($entity);
$this->getManagerRegistry()->getManager()->flush();
$this->managerRegistry->getManager()->persist($entity);
$this->managerRegistry->getManager()->flush();
$response = $this->onAfterFlush($action, $request, $_format, $entity, $errors);