From 3b5ef53b9b2e176dc08e9eea65315a5d1256063e Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 24 Jun 2021 15:46:04 +0200 Subject: [PATCH] (to rebase/fixup later) Let Result be associated to a SocialAction. --- .../Service/Import/SocialWorkMetadata.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php index b5ade864c..48dff99bc 100644 --- a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php @@ -160,7 +160,7 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface return $goal; } - private function handleResult(?string $resultTitle = null, SocialAction $socialAction, ?Goal $goal = null): ?Result + private function handleResult(?string $resultTitle = null, ?SocialAction $socialAction = null, ?Goal $goal = null): ?Result { if (null === $resultTitle) { return null; @@ -172,12 +172,15 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface if (null !== $goal) { $result->addGoal($goal); + } else { + $result->addSocialAction($socialAction); } - // Why this cannot be found from the Goal entity? $result->addSocialAction($socialAction); + $socialAction->addResult($result); $this->entityManager->persist($result); + $this->entityManager->persist($socialAction); return $result; }