feat: list upcoming season assignments among a teamer's dispositions

This commit is contained in:
fromme committed 2026-10-20 17:13:45 +02:00
1 parent 300bb2058f
commit c00dd86eb4
17 files changed
+386 -97

No files matched your search

+11
View File
@@ -52,6 +52,17 @@ class DispositionRepository extends ServiceEntityRepository
;
}
/**
* All of them, unlike getUpcomingDispositionsByTeamer(): merged with the season assignments
* by App\Service\Teamer\UpcomingPlacementCollector, which sorts and pages the result.
*
* @return Disposition[]
*/
public function findAllUpcomingByTeamer(Teamer $teamer): array
{
return $this->getUpcomingDispositionsByTeamerQuery($teamer)->getResult();
}
public function getUpcomingDispositionsByTeamer(Teamer $teamer, int $limit = 5): array
{
return $this
@@ -7,6 +7,7 @@ use App\Entity\Teamer;
use App\Model\SeasonAssignmentFilterDto;
use App\Repository\Traits\QueryHelperTrait;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
@@ -91,6 +92,42 @@ class SeasonAssignmentRepository extends ServiceEntityRepository
;
}
/**
* A teamer's season assignments that have not ended yet, earliest first - listed alongside
* the upcoming dispositions. A running season counts, just as a running disposition does.
*
* @return SeasonAssignment[]
*/
public function findUpcomingByTeamer(Teamer $teamer): array
{
return $this
->createUpcomingByTeamerQueryBuilder($teamer)
->getQuery()
->getResult()
;
}
/**
* Extracted so the conditions can be pinned by a test compiling the DQL.
*/
public function createUpcomingByTeamerQueryBuilder(Teamer $teamer): QueryBuilder
{
$qb = $this->createQueryBuilder('season_assignment');
return $qb
->select('season_assignment', 'job_profile')
->innerJoin('season_assignment.jobProfile', 'job_profile')
->where($qb->expr()->andX(
$qb->expr()->eq('season_assignment.teamer', ':teamer'),
$qb->expr()->isNull('season_assignment.deletedAt'),
$qb->expr()->gte('season_assignment.dateTo', ':today')
))
->setParameter('teamer', $teamer)
->setParameter('today', new \DateTimeImmutable('today'), Types::DATE_IMMUTABLE)
->addOrderBy('season_assignment.dateFrom', \SortDirection::Ascending)
;
}
/**
* Extracted so the conditions can be pinned by a test compiling the DQL - the suite has no
* fixtures, so what is asserted is what the query says, not what it returns.