From d8e00eae69816870dbb9b583db48cb32dc65a66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20H=C3=A9lias?= Date: Thu, 16 Nov 2023 14:25:28 +0100 Subject: [PATCH] Remove the reverse setter --- config/services.php | 3 +-- src/Services/IndexableFieldsService.php | 10 +--------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/config/services.php b/config/services.php index 874c3bd..6252a9b 100644 --- a/config/services.php +++ b/config/services.php @@ -85,8 +85,7 @@ ->args([ service('annotation_reader')->nullOnInvalid(), // @deprecated service(EntityManagerInterface::class), - service('encryption.indexes_generator'), - service('property_accessor') + service('encryption.indexes_generator') ]) ->alias(IndexableFieldsService::class, 'encryption.indexable_field') diff --git a/src/Services/IndexableFieldsService.php b/src/Services/IndexableFieldsService.php index fd21a9e..8efdce6 100644 --- a/src/Services/IndexableFieldsService.php +++ b/src/Services/IndexableFieldsService.php @@ -10,7 +10,6 @@ use Doctrine\Common\Annotations\Reader; use Doctrine\ORM\EntityManagerInterface; use Odandb\DoctrineCiphersweetEncryptionBundle\Exception\UndefinedGeneratorException; -use Symfony\Component\PropertyAccess\PropertyAccessorInterface; class IndexableFieldsService { @@ -20,14 +19,12 @@ class IndexableFieldsService private ?Reader $annReader; private EntityManagerInterface $em; private IndexesGenerator $indexesGenerator; - private PropertyAccessorInterface $propertyAccessor; - public function __construct(?Reader $annReader, EntityManagerInterface $em, IndexesGenerator $generator, PropertyAccessorInterface $propertyAccessor) + public function __construct(?Reader $annReader, EntityManagerInterface $em, IndexesGenerator $generator) { $this->annReader = $annReader; $this->em = $em; $this->indexesGenerator = $generator; - $this->propertyAccessor = $propertyAccessor; } /** @@ -176,11 +173,6 @@ public function handleIndexableFieldsForEntity(object $entity, array $fieldsCont } } } - - $setter = 'set' . $refClass->getShortName(); - if ($this->propertyAccessor->isWritable($entity, $setter)) { - $this->propertyAccessor->setValue($entity, $setter, $indexEntities); - } } }