From 433dbe27e80876382c18a10eaf9e11f9ddff4e49 Mon Sep 17 00:00:00 2001 From: Ishiki Date: Tue, 24 Mar 2020 09:46:21 +0200 Subject: [PATCH] Notification recipients list is not as expected We have encountered a bug, where doctrine metadata wont lazy load relations and in that case our notification recipients list is not as expected. Lots of users have not received their email because of this bug, it is maybe a Doctrine issue, but im adding PR just in case for someone with same bug. When we use property accessor then we basically use getters and all the relations will be lazy loaded. --- .../Provider/AdditionalEmailAssociationProvider.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Oro/Bundle/NotificationBundle/Provider/AdditionalEmailAssociationProvider.php b/src/Oro/Bundle/NotificationBundle/Provider/AdditionalEmailAssociationProvider.php index 0a161bc7a23..19889cf6040 100644 --- a/src/Oro/Bundle/NotificationBundle/Provider/AdditionalEmailAssociationProvider.php +++ b/src/Oro/Bundle/NotificationBundle/Provider/AdditionalEmailAssociationProvider.php @@ -70,8 +70,11 @@ public function isAssociationSupported($entity, string $associationName): bool */ public function getAssociationValue($entity, string $associationName) { - return $this->getEntityMetadata(ClassUtils::getClass($entity)) - ->getFieldValue($entity, $associationName); + $propertyAccessor = new PropertyAccessor(); + + return $propertyAccessor->isReadable($entity, $associationName) + ? $propertyAccessor->getValue($entity, $associationName) + : null; } /**