From e6ab1e48272bce346ce044b58baa7b9101adc6c9 Mon Sep 17 00:00:00 2001 From: Guillaume DUBOST Date: Fri, 6 Mar 2020 09:43:13 +0100 Subject: [PATCH] Gestion des liaisons pour le setPropertiesToEntity --- src/Entity/AbstractEntityService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Entity/AbstractEntityService.php b/src/Entity/AbstractEntityService.php index 3d4fb9c..33a6ca2 100644 --- a/src/Entity/AbstractEntityService.php +++ b/src/Entity/AbstractEntityService.php @@ -38,7 +38,8 @@ protected function setPropertiesToEntity(array $datas, array $validation_groups, $filtered_datas = []; $validation_field_metadata = $this->validator->getMetadataFor($entity)->members; $doctrine_field_metadata = $this->em->getClassMetadata(get_class($entity))->fieldMappings; - $all_fields = array_keys($doctrine_field_metadata); + $doctrine_assoc_metadata = $this->em->getClassMetadata(get_class($entity))->associationMappings; + $all_fields = array_keys(array_merge($doctrine_field_metadata, $doctrine_assoc_metadata)); foreach ($datas as $field_name => $data_value) { $is_field_concerned = false;