(to rebase/fixup later) Let Result be associated to a SocialAction.

This commit is contained in:
Pol Dellaiera 2021-06-24 15:46:04 +02:00
parent 18d0ad67d6
commit 3b5ef53b9b

View File

@ -160,7 +160,7 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface
return $goal; 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) { if (null === $resultTitle) {
return null; return null;
@ -172,12 +172,15 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface
if (null !== $goal) { if (null !== $goal) {
$result->addGoal($goal); $result->addGoal($goal);
} else {
$result->addSocialAction($socialAction);
} }
// Why this cannot be found from the Goal entity?
$result->addSocialAction($socialAction); $result->addSocialAction($socialAction);
$socialAction->addResult($result);
$this->entityManager->persist($result); $this->entityManager->persist($result);
$this->entityManager->persist($socialAction);
return $result; return $result;
} }