mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
fix conflict with where clause in indicator ; initiate a filter test
This commit is contained in:
parent
0d38d4df40
commit
d5d3866122
@ -93,9 +93,6 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
|
||||
|
||||
$qb->select('COUNT(acp.id) AS export_result')
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
|
||||
->where($expr->neq(
|
||||
'acp.step', $expr->literal('DRAFT')
|
||||
))
|
||||
;
|
||||
|
||||
return $qb;
|
||||
|
@ -131,9 +131,6 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
|
||||
ELSE :force_closingDate
|
||||
END ) - acp.openingDate
|
||||
) AS export_result')
|
||||
->where($expr->neq(
|
||||
'acp.step', $expr->literal('DRAFT')
|
||||
))
|
||||
->setParameter('force_closingDate', $force_closingdate)
|
||||
;
|
||||
|
||||
|
@ -82,10 +82,10 @@ class SocialIssueFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->join('acp.socialIssues', 's');
|
||||
$qb->join('acp.socialIssues', 'si');
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('s.id', ':socialissues');
|
||||
$clause = $qb->expr()->in('si.id', ':socialissues');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
@ -128,7 +128,7 @@ class SocialIssueFilter implements FilterInterface
|
||||
return $item->getId();
|
||||
}, $array);
|
||||
|
||||
$unique_ids = array_unique($ids); dump($unique_ids);
|
||||
$unique_ids = array_unique($ids);
|
||||
|
||||
return array_values(
|
||||
array_intersect_key($array, $unique_ids));
|
||||
|
@ -70,8 +70,11 @@ class StepFilter implements FilterInterface
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->eq('acp.step', ':step');
|
||||
|
||||
// override original where clause
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('step', $data['accepted_step']);
|
||||
|
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
|
||||
final class SocialIssueFilterTest extends AbstractFilterTest
|
||||
{
|
||||
/**
|
||||
* @var \Chill\PersonBundle\Export\Filter\GenderFilter
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
self::bootKernel();
|
||||
|
||||
try {
|
||||
$this->filter = self::$container->get('chill.person.export.filter_socialissue');
|
||||
} catch (ServiceNotFoundException $e) {
|
||||
$this->markTestSkipped('Filter service is not found');
|
||||
}
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return [
|
||||
['accepted_socialissue' => [
|
||||
|
||||
]],
|
||||
['accepted_socialissue' => [
|
||||
|
||||
]],
|
||||
['accepted_socialissue' => [
|
||||
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
// TODO: Implement getQueryBuilders() method.
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user