optiomisation sur annonces lues / non lues (ref #33746)
This commit is contained in:
parent
d0d933f28e
commit
c6d349696e
|
@ -46,6 +46,8 @@ class AlertRepository extends EntityRepository
|
||||||
$niveau01=($user?$user->getNiveau01():null);
|
$niveau01=($user?$user->getNiveau01():null);
|
||||||
$groups=($user?$user->getGroups():[]);
|
$groups=($user?$user->getGroups():[]);
|
||||||
|
|
||||||
|
$userreads=($user?$user->getAlertreaders():[]);
|
||||||
|
|
||||||
// Initialisation du calcul des alerts
|
// Initialisation du calcul des alerts
|
||||||
$alerts=new ArrayCollection();
|
$alerts=new ArrayCollection();
|
||||||
|
|
||||||
|
@ -67,8 +69,9 @@ class AlertRepository extends EntityRepository
|
||||||
->setParameter("alertcategory",$alertcategoryfilter);
|
->setParameter("alertcategory",$alertcategoryfilter);
|
||||||
}
|
}
|
||||||
$alertsroles=$qb->getQuery()->getResult();
|
$alertsroles=$qb->getQuery()->getResult();
|
||||||
|
|
||||||
foreach($alertsroles as $alertrole) {
|
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();
|
$alertsniveau01s=$qb->getQuery()->getResult();
|
||||||
foreach($alertsniveau01s as $alertniveau01) {
|
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
|
// Récupération des alerts par group
|
||||||
|
@ -114,7 +117,7 @@ class AlertRepository extends EntityRepository
|
||||||
}
|
}
|
||||||
$alertsgroups=$qb->getQuery()->getResult();
|
$alertsgroups=$qb->getQuery()->getResult();
|
||||||
foreach($alertsgroups as $alertgroup) {
|
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();
|
$alertsitems=$qb->getQuery()->getResult();
|
||||||
foreach($alertsitems as $alertitem) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue