feat: filter assignments and applications by teamer name

closes #869b9vgq7
This commit is contained in:
Björn Fromme
2026-03-15 12:42:28 +01:00
parent e45f6458d4
commit ed41d40059
10 changed files with 105 additions and 6 deletions
+29
View File
@@ -4,9 +4,11 @@ namespace App\Repository;
use App\Entity\Application;
use App\Entity\Assignment;
use App\Entity\Disposition;
use App\Entity\JobProfile;
use App\Entity\Teamer;
use App\Model\AssignmentFilterDto;
use App\Repository\Traits\QueryHelperTrait;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\Expr\Join;
@@ -23,6 +25,8 @@ use Doctrine\Persistence\ManagerRegistry;
*/
class AssignmentRepository extends ServiceEntityRepository
{
use QueryHelperTrait;
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Assignment::class);
@@ -194,6 +198,31 @@ class AssignmentRepository extends ServiceEntityRepository
;
}
$teamerName = $filterDto->getTeamerName();
if (null !== $teamerName && '' !== trim($teamerName)) {
$subQb = $this->getEntityManager()->createQueryBuilder();
$subQb
->select('1')
->from(Disposition::class, 'disposition_filter')
->innerJoin('disposition_filter.teamer', 'teamer_filter')
->innerJoin('teamer_filter.user', 'user_filter')
->where($subQb->expr()->andX(
$subQb->expr()->eq('disposition_filter.assignment', 'assignment'),
$subQb->expr()->neq('disposition_filter.status', ':dispositionCalledOffStatus'),
$subQb->expr()->orX(
$subQb->expr()->like('user_filter.firstName', ':teamerName'),
$subQb->expr()->like('user_filter.lastName', ':teamerName')
)
))
;
$qb
->andWhere($qb->expr()->exists($subQb->getDQL()))
->setParameter('dispositionCalledOffStatus', Disposition::STATUS_CALLED_OFF)
->setParameter('teamerName', '%'.$this->escapeLikeWildcards($teamerName).'%')
;
}
if (true === $filterDto->isNotSyncedWithBusProNet()) {
$qb
->andWhere($qb->expr()->eq('disposition.syncedWithBusProNet', ':syncedWithBusProNet'))