feat: manual sorting of additional services
This commit is contained in:
@@ -6,6 +6,7 @@ namespace App\Repository\Groups;
|
||||
|
||||
use App\Entity\Groups\AdditionalService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
@@ -20,4 +21,16 @@ class AdditionalServiceRepository extends ServiceEntityRepository
|
||||
{
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user