mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[export][person] Fixed: use left join on association between works and
goal/results
This commit is contained in:
parent
95f7622923
commit
e3764f6f91
@ -40,7 +40,7 @@ final class ActionTypeAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwsocialaction', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.socialAction', 'acpwsocialaction');
|
||||
$qb->leftJoin('acpw.socialAction', 'acpwsocialaction');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpwsocialaction.id as action_type_aggregator');
|
||||
|
@ -35,6 +35,10 @@ class GoalResultAggregator implements AggregatorInterface
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value) use ($key): string {
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
switch ($key) {
|
||||
case 'goal_aggregator':
|
||||
|
||||
@ -107,25 +111,16 @@ class GoalResultAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.goals', 'goal');
|
||||
$qb->leftJoin('acpw.goals', 'goal');
|
||||
}
|
||||
|
||||
if (!in_array('goalresult', $qb->getAllAliases(), true)) {
|
||||
$qb->join('goal.results', 'goalresult');
|
||||
$qb->leftJoin('goal.results', 'goalresult');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(goal.goal) as goal_aggregator');
|
||||
$qb->addSelect('goalresult.id as result_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('goal_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('goal_aggregator');
|
||||
}
|
||||
|
||||
$qb->addGroupBy('result_aggregator');
|
||||
$qb->addGroupBy('goal_aggregator')->addGroupBy('result_aggregator');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,4 +130,4 @@ class GoalResultAggregator implements AggregatorInterface
|
||||
{
|
||||
return Declarations::SOCIAL_WORK_ACTION_TYPE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ final class ResultAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('result', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.results', 'result');
|
||||
$qb->leftJoin('acpw.results', 'result');
|
||||
}
|
||||
|
||||
$qb->addSelect('result.id AS acpw_result_aggregator');
|
||||
|
Loading…
x
Reference in New Issue
Block a user