Compare commits

...

2 Commits

1 changed files with 10 additions and 7 deletions

View File

@ -46,6 +46,8 @@ class AlertRepository extends EntityRepository
$niveau01=($user?$user->getNiveau01():null);
$groups=($user?$user->getGroups():[]);
$userreads=($user?$user->getAlertreaders():[]);
// Initialisation du calcul des alerts
$alerts=new ArrayCollection();
@ -67,8 +69,9 @@ class AlertRepository extends EntityRepository
->setParameter("alertcategory",$alertcategoryfilter);
}
$alertsroles=$qb->getQuery()->getResult();
foreach($alertsroles as $alertrole) {
if(!$alerts->contains($alertrole)&&!$alertrole->getReaders()->contains($user)) $alerts->add($alertrole);
if(!$alerts->contains($alertrole)&&!$userreads->contains($alertrole)) $alerts->add($alertrole);
}
}
@ -91,7 +94,7 @@ class AlertRepository extends EntityRepository
}
$alertsniveau01s=$qb->getQuery()->getResult();
foreach($alertsniveau01s as $alertniveau01) {
if(!$alerts->contains($alertniveau01)&&!$alertniveau01->getReaders()->contains($user)) $alerts->add($alertniveau01);
if(!$alerts->contains($alertniveau01)&&!$userreads->contains($alertniveau01)) $alerts->add($alertniveau01);
}
// Récupération des alerts par group
@ -114,7 +117,7 @@ class AlertRepository extends EntityRepository
}
$alertsgroups=$qb->getQuery()->getResult();
foreach($alertsgroups as $alertgroup) {
if(!$alerts->contains($alertgroup)&&!$alertgroup->getReaders()->contains($user)) $alerts->add($alertgroup);
if(!$alerts->contains($alertgroup)&&!$userreads->contains($alertgroup)) $alerts->add($alertgroup);
}
}
@ -142,7 +145,7 @@ class AlertRepository extends EntityRepository
}
$alertsitems=$qb->getQuery()->getResult();
foreach($alertsitems as $alertitem) {
if(!$alerts->contains($alertitem)&&!$alertitem->getReaders()->contains($user)) $alerts->add($alertitem);
if(!$alerts->contains($alertitem)&&!$userreads->contains($alertitem)) $alerts->add($alertitem);
}
}