mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '693-filter-acp-by-user-job' into 'master'
693 on doit utiliser le métier du référent, et pas le métier du parcours See merge request Chill-Projet/chill-bundles!482
This commit is contained in:
commit
d6df16973a
@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
final class JobAggregator implements AggregatorInterface
|
||||
final class UserJobAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserJobRepository $jobRepository;
|
||||
|
||||
@ -40,11 +40,11 @@ final class JobAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpjob', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('acp.job', 'acpjob');
|
||||
if (!in_array('acpuser', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('acp.user', 'acpuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acp.job) AS job_aggregator');
|
||||
$qb->addSelect('IDENTITY(acpuser.userJob) AS job_aggregator');
|
||||
$qb->addGroupBy('job_aggregator');
|
||||
}
|
||||
|
@ -126,12 +126,4 @@ class UserJobFilter implements FilterInterface
|
||||
{
|
||||
return 'Filter by user job';
|
||||
}
|
||||
|
||||
private function getUserJob(): UserJob
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->security->getUser();
|
||||
|
||||
return $user->getUserJob();
|
||||
}
|
||||
}
|
||||
|
@ -13,16 +13,16 @@ namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregato
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\JobAggregator;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\UserJobAggregator;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
final class UserJobAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private JobAggregator $aggregator;
|
||||
private UserJobAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
@ -136,7 +136,7 @@ services:
|
||||
- { name: chill.export_aggregator, alias: accompanyingcourse_scope_aggregator }
|
||||
|
||||
chill.person.export.aggregator_referrer_job:
|
||||
class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\JobAggregator
|
||||
class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\UserJobAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: accompanyingcourse_referrer_job_aggregator }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user