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; }