mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add RegroupmentRepositoryInterface and integrate it
Created a new `RegroupmentRepositoryInterface` to define repository methods for Regroupment entities. Updated `RegroupmentRepository` to implement this interface, and replaced its usage in `ExportConfigNormalizer` for better abstraction and testability.
This commit is contained in:
parent
ee65c46d2a
commit
2b88593e64
@ -18,6 +18,7 @@ use Chill\MainBundle\Form\Type\Export\ExportType;
|
||||
use Chill\MainBundle\Form\Type\Export\FilterType;
|
||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||
use Chill\MainBundle\Repository\RegroupmentRepository;
|
||||
use Chill\MainBundle\Repository\RegroupmentRepositoryInterface;
|
||||
|
||||
/**
|
||||
* @phpstan-type NormalizedData array{centers: array{centers: list<int>, regroupments: list<int>}, export: array{form: array<string, mixed>, version: int}, filters: array<string, array{enabled: boolean, form: array<string, mixed>, version: int}>, aggregators: array<string, array{enabled: boolean, form: array<string, mixed>, version: int}>, pick_formatter: string, formatter: array{form: array<string, mixed>, version: int}}
|
||||
@ -27,7 +28,7 @@ class ExportConfigNormalizer
|
||||
public function __construct(
|
||||
private readonly ExportManager $exportManager,
|
||||
private readonly CenterRepositoryInterface $centerRepository,
|
||||
private readonly RegroupmentRepository $regroupmentRepository,
|
||||
private readonly RegroupmentRepositoryInterface $regroupmentRepository,
|
||||
) {}
|
||||
|
||||
/**
|
||||
|
@ -18,7 +18,7 @@ use Doctrine\ORM\NonUniqueResultException;
|
||||
use Doctrine\ORM\NoResultException;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final readonly class RegroupmentRepository implements ObjectRepository
|
||||
final readonly class RegroupmentRepository implements RegroupmentRepositoryInterface
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Repository;
|
||||
|
||||
use Chill\MainBundle\Entity\Regroupment;
|
||||
use Doctrine\ORM\NonUniqueResultException;
|
||||
use Doctrine\ORM\NoResultException;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
/**
|
||||
* @template-extends ObjectRepository<Regroupment>
|
||||
*/
|
||||
interface RegroupmentRepositoryInterface extends ObjectRepository
|
||||
{
|
||||
/**
|
||||
* @throws NonUniqueResultException
|
||||
* @throws NoResultException
|
||||
*/
|
||||
public function findOneByName(string $name): ?Regroupment;
|
||||
|
||||
/**
|
||||
* @return array<Regroupment>
|
||||
*/
|
||||
public function findRegroupmentAssociatedToNoCenter(): array;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user