Rector changes: repositories become final readonly classes

This commit is contained in:
Julie Lenaerts 2024-07-18 09:49:05 +02:00
parent 3fc3f32c5f
commit c82991674e
42 changed files with 111 additions and 111 deletions

View File

@ -15,9 +15,9 @@ use Chill\ActivityBundle\Entity\ActivityType;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
final readonly class ActivityTypeRepository implements ActivityTypeRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $em)
{

View File

@ -15,9 +15,9 @@ use Chill\BudgetBundle\Entity\ChargeKind;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class ChargeKindRepository implements ChargeKindRepositoryInterface
final readonly class ChargeKindRepository implements ChargeKindRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\BudgetBundle\Entity\ResourceKind;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class ResourceKindRepository implements ResourceKindRepositoryInterface
final readonly class ResourceKindRepository implements ResourceKindRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -21,14 +21,14 @@ use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
final class RelatorioDriver implements DriverInterface
final readonly class RelatorioDriver implements DriverInterface
{
private readonly string $url;
private string $url;
public function __construct(
private readonly HttpClientInterface $client,
private HttpClientInterface $client,
ParameterBagInterface $parameterBag,
private readonly LoggerInterface $logger
private LoggerInterface $logger
) {
$this->url = $parameterBag->get('chill_doc_generator')['driver']['relatorio']['url'];
}

View File

@ -16,11 +16,11 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\HttpFoundation\RequestStack;
final class DocGeneratorTemplateRepository implements DocGeneratorTemplateRepositoryInterface
final readonly class DocGeneratorTemplateRepository implements DocGeneratorTemplateRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager, private readonly RequestStack $requestStack)
public function __construct(EntityManagerInterface $entityManager, private RequestStack $requestStack)
{
$this->repository = $entityManager->getRepository(DocGeneratorTemplate::class);
}

View File

@ -20,11 +20,11 @@ use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Doctrine\Persistence\ObjectRepository;
final class AddressReferenceRepository implements ObjectRepository
final readonly class AddressReferenceRepository implements ObjectRepository
{
private readonly EntityManagerInterface $entityManager;
private EntityManagerInterface $entityManager;
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class AddressRepository implements ObjectRepository
final readonly class AddressRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\Center;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class CenterRepository implements CenterRepositoryInterface
final readonly class CenterRepository implements CenterRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class CountryRepository implements ObjectRepository
final readonly class CountryRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\GeographicalUnitLayer;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface
final readonly class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $em)
{

View File

@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
final class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
final readonly class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $em)
{

View File

@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class GroupCenterRepository implements ObjectRepository
final readonly class GroupCenterRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\Language;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class LanguageRepository implements LanguageRepositoryInterface
final readonly class LanguageRepository implements LanguageRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class PermissionsGroupRepository implements ObjectRepository
final readonly class PermissionsGroupRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -19,11 +19,11 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
final class PostalCodeRepository implements PostalCodeRepositoryInterface
final readonly class PostalCodeRepository implements PostalCodeRepositoryInterface
{
private readonly EntityManagerInterface $entityManager;
private EntityManagerInterface $entityManager;
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -18,9 +18,9 @@ use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
use Doctrine\Persistence\ObjectRepository;
final class RegroupmentRepository implements ObjectRepository
final readonly class RegroupmentRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class RoleScopeRepository implements ObjectRepository
final readonly class RoleScopeRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -17,11 +17,11 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
final class ScopeRepository implements ScopeRepositoryInterface
final readonly class ScopeRepository implements ScopeRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager, private readonly TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(EntityManagerInterface $entityManager, private TranslatableStringHelperInterface $translatableStringHelper)
{
$this->repository = $entityManager->getRepository(Scope::class);
}

View File

@ -15,11 +15,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Contracts\Translation\TranslatorInterface;
final class TranslatableStringHelper implements TranslatableStringHelperInterface
final readonly class TranslatableStringHelper implements TranslatableStringHelperInterface
{
private readonly string $defaultLocale;
private string $defaultLocale;
public function __construct(private readonly RequestStack $requestStack, private readonly TranslatorInterface $translator, ParameterBagInterface $parameterBag)
public function __construct(private RequestStack $requestStack, private TranslatorInterface $translator, ParameterBagInterface $parameterBag)
{
$this->defaultLocale = $parameterBag->get('kernel.default_locale');
}

View File

@ -20,13 +20,13 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final class OriginAggregator implements AggregatorInterface
final readonly class OriginAggregator implements AggregatorInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(
EntityManagerInterface $em,
private readonly TranslatableStringHelper $translatableStringHelper
private TranslatableStringHelper $translatableStringHelper
) {
$this->repository = $em->getRepository(Origin::class);
}

View File

@ -21,9 +21,9 @@ use Doctrine\ORM\EntityRepository;
* @method AccompanyingPeriodWorkGoal[] findAll()
* @method AccompanyingPeriodWorkGoal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
final class AccompanyingPeriodWorkGoalRepository
final readonly class AccompanyingPeriodWorkGoalRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class CommentRepository
final readonly class CommentRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class OriginRepository
final readonly class OriginRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class ResourceRepository
final readonly class ResourceRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class AccompanyingPeriodParticipationRepository
final readonly class AccompanyingPeriodParticipationRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class AccompanyingPeriodRepository implements ObjectRepository
final readonly class AccompanyingPeriodRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -16,9 +16,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdComposition;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class HouseholdCompositionRepository implements HouseholdCompositionRepositoryInterface
final readonly class HouseholdCompositionRepository implements HouseholdCompositionRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class HouseholdCompositionTypeRepository implements HouseholdCompositionTypeRepositoryInterface
final readonly class HouseholdCompositionTypeRepository implements HouseholdCompositionTypeRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdMember;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class HouseholdMembersRepository
final readonly class HouseholdMembersRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -18,7 +18,7 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Doctrine\Persistence\ObjectRepository;
final class HouseholdRepository implements ObjectRepository
final readonly class HouseholdRepository implements ObjectRepository
{
private const SQL_BY_ACCOMPANYING_PERIOD_PARTICIPATION = <<<'SQL'
WITH participations AS (
@ -40,9 +40,9 @@ final class HouseholdRepository implements ObjectRepository
SELECT {select} FROM households {limits}
SQL;
private readonly EntityManagerInterface $em;
private EntityManagerInterface $em;
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class PersonHouseholdAddressRepository implements ObjectRepository
final readonly class PersonHouseholdAddressRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $em)
{

View File

@ -18,9 +18,9 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class PositionRepository implements ObjectRepository
final readonly class PositionRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\PersonAltName;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class PersonAltNameRepository
final readonly class PersonAltNameRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -16,9 +16,9 @@ use Chill\PersonBundle\Entity\PersonNotDuplicate;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class PersonNotDuplicateRepository
final readonly class PersonNotDuplicateRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class PersonResourceRepository implements ObjectRepository
final readonly class PersonResourceRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\SocialWork\Evaluation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class EvaluationRepository implements EvaluationRepositoryInterface
final readonly class EvaluationRepository implements EvaluationRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class GoalRepository implements ObjectRepository
final readonly class GoalRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -19,9 +19,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class ResultRepository implements ObjectRepository
final readonly class ResultRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class SocialActionRepository implements ObjectRepository
final readonly class SocialActionRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class SocialIssueRepository implements ObjectRepository
final readonly class SocialIssueRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@ -47,25 +47,25 @@ use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @see PersonContextTest
*/
final class PersonContext implements PersonContextInterface
final readonly class PersonContext implements PersonContextInterface
{
private readonly bool $showScopes;
private bool $showScopes;
public function __construct(
private readonly AuthorizationHelperInterface $authorizationHelper,
private readonly BaseContextData $baseContextData,
private readonly CenterResolverManagerInterface $centerResolverManager,
private readonly DocumentCategoryRepository $documentCategoryRepository,
private readonly EntityManagerInterface $em,
private readonly NormalizerInterface $normalizer,
private AuthorizationHelperInterface $authorizationHelper,
private BaseContextData $baseContextData,
private CenterResolverManagerInterface $centerResolverManager,
private DocumentCategoryRepository $documentCategoryRepository,
private EntityManagerInterface $em,
private NormalizerInterface $normalizer,
ParameterBagInterface $parameterBag,
private readonly ScopeRepositoryInterface $scopeRepository,
private readonly Security $security,
private readonly TranslatorInterface $translator,
private readonly TranslatableStringHelperInterface $translatableStringHelper,
private readonly ThirdPartyRender $thirdPartyRender,
private readonly ThirdPartyRepository $thirdPartyRepository,
private readonly ResidentialAddressRepository $residentialAddressRepository
private ScopeRepositoryInterface $scopeRepository,
private Security $security,
private TranslatorInterface $translator,
private TranslatableStringHelperInterface $translatableStringHelper,
private ThirdPartyRender $thirdPartyRender,
private ThirdPartyRepository $thirdPartyRepository,
private ResidentialAddressRepository $residentialAddressRepository
) {
$this->showScopes = $parameterBag->get('chill_main')['acl']['form_show_scopes'];
}

View File

@ -27,18 +27,18 @@ use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Mime\MimeTypes;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
final class ChillDocumentManager implements DocumentManagerInterface
final readonly class ChillDocumentManager implements DocumentManagerInterface
{
private readonly RequestInterface $request;
private RequestInterface $request;
public function __construct(
private readonly DocumentLockManagerInterface $documentLockManager,
private readonly EntityManagerInterface $entityManager,
private DocumentLockManagerInterface $documentLockManager,
private EntityManagerInterface $entityManager,
HttpMessageFactoryInterface $httpMessageFactory,
private readonly Psr17Interface $psr17,
private Psr17Interface $psr17,
RequestStack $requestStack,
private readonly StoredObjectManagerInterface $storedObjectManager,
private readonly StoredObjectRepository $storedObjectRepository
private StoredObjectManagerInterface $storedObjectManager,
private StoredObjectRepository $storedObjectRepository
) {
$this->request = $httpMessageFactory->createRequest($requestStack->getCurrentRequest());
}