From 3d3cc9aeb4a21588fbfce3a11b9ff822dd267132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 13 Dec 2021 22:19:05 +0100 Subject: [PATCH] fix import --- .../Entity/SocialWork/SocialAction.php | 4 ++-- .../Service/Import/SocialWorkMetadata.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index 693a44eee..391a9ce89 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -46,9 +46,9 @@ class SocialAction private $desactivationDate; /** - * @ORM\OneToMany( + * @ORM\ManyToMany( * targetEntity=Evaluation::class, - * mappedBy="socialAction" + * mappedBy="socialActions" * ) */ private Collection $evaluations; diff --git a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php index a432d6837..53d24c788 100644 --- a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php @@ -192,7 +192,7 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface /** @var Evaluation $eval */ $eval = $this->getOrCreateEntity($this->evaluationRepository, 'title', ['fr' => $evaluationTitle]); $eval->setTitle(['fr' => $evaluationTitle]); - $eval->setSocialAction($socialAction); + $eval->addSocialAction($socialAction); $this->entityManager->persist($eval); @@ -212,7 +212,7 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface $socialAction->addGoal($goal); $goal->addSocialAction($socialAction); - //$this->entityManager->persist($socialAction); + $this->entityManager->persist($socialAction); $this->entityManager->persist($goal); return $goal; @@ -239,7 +239,7 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface } $this->entityManager->persist($result); - //$this->entityManager->persist($socialAction); + $this->entityManager->persist($socialAction); return $result; } @@ -380,8 +380,8 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface if (null !== $socialAction) { $goal = $this->handleGoal($row[4], $socialAction); - $result = $this->handleResult($row[5], $socialActions['socialAction'], $goal); - $eval = $this->handleEvaluation($row[6], $socialActions['socialAction']); + $result = $this->handleResult($row[5], $socialAction, $goal); + $eval = $this->handleEvaluation($row[6], $socialAction); } $this->entityManager->flush();