37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Repository\Groups;
|
|
|
|
use App\Entity\Groups\AdditionalService;
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
use Doctrine\ORM\QueryBuilder;
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
|
|
/**
|
|
* @extends ServiceEntityRepository<AdditionalService>
|
|
*/
|
|
class AdditionalServiceRepository extends ServiceEntityRepository
|
|
{
|
|
/** @use FindsByAccommodationAndDateRangeTrait<AdditionalService> */
|
|
use FindsByAccommodationAndDateRangeTrait;
|
|
|
|
public function __construct(ManagerRegistry $registry)
|
|
{
|
|
parent::__construct($registry, AdditionalService::class);
|
|
}
|
|
|
|
/**
|
|
* Additional services are ordered manually in the admin; dateFrom and id only break ties
|
|
* between records that share a position (newly created or duplicated ones).
|
|
*/
|
|
protected function applyOrdering(QueryBuilder $queryBuilder): void
|
|
{
|
|
$queryBuilder
|
|
->orderBy('s.position', 'ASC')
|
|
->addOrderBy('s.dateFrom', 'ASC')
|
|
->addOrderBy('s.id', 'ASC');
|
|
}
|
|
}
|