mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix: Remove deprecations.
This commit is contained in:
parent
ae79ebc299
commit
7fd45d5735
@ -22,7 +22,6 @@ use Chill\MainBundle\Timeline\TimelineSingleQuery;
|
||||
*/
|
||||
class TimelineReportProvider implements TimelineProviderInterface
|
||||
{
|
||||
|
||||
protected EntityManager $em;
|
||||
|
||||
protected AuthorizationHelper $helper;
|
||||
@ -84,10 +83,12 @@ class TimelineReportProvider implements TimelineProviderInterface
|
||||
|
||||
private function getWhereClauseForCenter(string $context, array $args): array
|
||||
{
|
||||
$role = 'CHILL_REPORT_SEE';
|
||||
|
||||
$report = $this->em->getClassMetadata(Report::class);
|
||||
$person = $this->em->getClassMetadata(Person::class);
|
||||
$role = new Role('CHILL_REPORT_SEE');
|
||||
$reachableCenters = $this->helper->getReachableCenters($this->security->getUser(), $role->getRole());
|
||||
|
||||
$reachableCenters = $this->helper->getReachableCenters($this->security->getUser(), $role);
|
||||
$reportPersonId = $report->getAssociationMapping('person')['joinColumns'][0]['name'];
|
||||
$reportScopeId = $report->getAssociationMapping('scope')['joinColumns'][0]['name'];
|
||||
$personCenterId = $person->getAssociationMapping('center')['joinColumns'][0]['name'];
|
||||
@ -110,7 +111,7 @@ class TimelineReportProvider implements TimelineProviderInterface
|
||||
$parameters[] = $center->getId();
|
||||
// loop over scopes
|
||||
$scopeIds = [];
|
||||
foreach ($this->helper->getReachableScopes($this->security->getUser(), $role->getRole(), $center) as $scope) {
|
||||
foreach ($this->helper->getReachableScopes($this->security->getUser(), $role, $center) as $scope) {
|
||||
if (\in_array($scope->getId(), $scopeIds)) {
|
||||
continue;
|
||||
}
|
||||
@ -144,9 +145,9 @@ class TimelineReportProvider implements TimelineProviderInterface
|
||||
|
||||
private function getWhereClauseForPerson(string $context, array $args): array
|
||||
{
|
||||
$role = 'CHILL_REPORT_SEE';
|
||||
$report = $this->em->getClassMetadata(Report::class);
|
||||
$person = $this->em->getClassMetadata(Person::class);
|
||||
$role = new Role('CHILL_REPORT_SEE');
|
||||
$reportPersonId = $report->getAssociationMapping('person')['joinColumns'][0]['name'];
|
||||
$reportScopeId = $report->getAssociationMapping('scope')['joinColumns'][0]['name'];
|
||||
$personCenterId = $person->getAssociationMapping('center')['joinColumns'][0]['name'];
|
||||
@ -156,7 +157,7 @@ class TimelineReportProvider implements TimelineProviderInterface
|
||||
// this is the final clause that we are going to fill
|
||||
$clause = "{report}.{person_id} = ? AND {report}.{scopes_id} IN ({scopes_ids})";
|
||||
// iterate over reachable scopes
|
||||
$scopes = $this->helper->getReachableScopes($this->security->getUser(), $role->getRole(), $args['person']->getCenter());
|
||||
$scopes = $this->helper->getReachableScopes($this->security->getUser(), $role, $args['person']->getCenter());
|
||||
|
||||
foreach ($scopes as $scope) {
|
||||
if (\in_array($scope->getId(), $parameters)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user