mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add condition on join clause to improve combined Filters/Aggregators
This commit is contained in:
parent
619ae4e458
commit
4e12684f98
@ -78,10 +78,10 @@ final class EvaluationAggregator implements AggregatorInterface
|
||||
*/
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.accompanyingPeriodWorkEvaluations', 'we')
|
||||
;
|
||||
if (!in_array('acpw', $qb->getAllAliases())) {
|
||||
$qb->join('acp.works', 'acpw');
|
||||
}
|
||||
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'we');
|
||||
|
||||
$qb->addSelect('IDENTITY(we.evaluation) AS evaluation_aggregator');
|
||||
|
||||
|
@ -76,7 +76,9 @@ final class SocialActionAggregator implements AggregatorInterface
|
||||
*/
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->join('acp.works', 'acpw');
|
||||
if (!in_array('acpw', $qb->getAllAliases())) {
|
||||
$qb->join('acp.works', 'acpw');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator'); // DISTINCT ??
|
||||
|
||||
|
@ -69,9 +69,10 @@ class SocialActionFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->join('acp.works', 'acpw')
|
||||
->join('acpw.socialAction', 'sa')
|
||||
;
|
||||
if (!in_array('acpw', $qb->getAllAliases())) {
|
||||
$qb->join('acp.works', 'acpw');
|
||||
}
|
||||
$qb->join('acpw.socialAction', 'sa');
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('sa.id', ':socialactions');
|
||||
|
@ -72,10 +72,10 @@ class JobFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->join('acpw.referrers', 'r');
|
||||
$qb->join('acpw.referrers', 'u');
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('r.userJob', ':job');
|
||||
$clause = $qb->expr()->in('u.userJob', ':job');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
|
@ -71,10 +71,10 @@ class ScopeFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->join('acpw.referrers', 'r');
|
||||
$qb->join('acpw.referrers', 'u');
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('r.mainScope', ':scope');
|
||||
$clause = $qb->expr()->in('u.mainScope', ':scope');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
|
Loading…
x
Reference in New Issue
Block a user