Feature: [export] filter accompanying period which has no action - work

This commit is contained in:
2022-11-02 13:44:04 +01:00
parent 24873f0cc2
commit 51ac4e0938
2 changed files with 5 additions and 9 deletions

View File

@@ -12,10 +12,10 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
use Chill\MainBundle\Export\FilterInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
class HasNoActionFilter implements FilterInterface
{
@@ -24,13 +24,9 @@ class HasNoActionFilter implements FilterInterface
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
public function alterQuery(QueryBuilder $qb, $data): void
{
if (!in_array('acpw', $qb->getAllAliases(), true)) {
$qb->join('acp.works', 'acpw');
}
$qb->andWhere('COUNT(acp.works) IS NULL');
$qb->andWhere('NOT EXISTS (SELECT 1 FROM ' . AccompanyingPeriodWork::class . ' work WHERE work.accompanyingPeriod = acp)');
}
public function applyOn(): string
@@ -38,7 +34,7 @@ class HasNoActionFilter implements FilterInterface
return Declarations::ACP_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
public function buildForm(FormBuilderInterface $builder): void
{
// no form
}