diff --git a/CHANGELOG.md b/CHANGELOG.md index eed759261..818eb1ef3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,12 @@ and this project adheres to ## Unreleased +* [admin] repair edit of social action in the admin (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/601) * [admin]: add select2 to Goal form type entity fields (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/702) * [main] allow hide permissions group list menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577) * [main] allow hide change user password menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577) * [main] filter user jobs by active jobs (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577) * [main] add civility to User (entity, migration and form type) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577) - * [admin] refactorisation of the admin section: reorganisation of the menu, translations, form types, new entities (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/592) * [admin] add admin section for languages and countries (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/596) * [activity] activity admin: translations + remove label field for comment on admin activity type (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/587) diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index 904950489..fbd271b44 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -46,10 +46,8 @@ class SocialAction private $desactivationDate; /** - * @ORM\ManyToMany( - * targetEntity=Evaluation::class, - * mappedBy="socialActions" - * ) + * @ORM\ManyToMany(targetEntity=Evaluation::class, inversedBy="socialActions") + * @ORM\JoinTable(name="chill_person_social_work_evaluation_action") */ private Collection $evaluations; @@ -110,6 +108,15 @@ class SocialAction return $this; } + public function addEvaluation(Evaluation $evaluation): self + { + if (!$this->evaluations->contains($evaluation)) { + $this->evaluations[] = $evaluation; + } + + return $this; + } + public function addGoal(Goal $goal): self { if (!$this->goals->contains($goal)) { @@ -300,6 +307,13 @@ class SocialAction return $this; } + public function removeEvaluation(Evaluation $evaluation): self + { + $this->evaluations->removeElement($evaluation); + + return $this; + } + public function removeGoal(Goal $goal): self { $this->goals->removeElement($goal); diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php index 5fc77b410..812062137 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php @@ -43,17 +43,6 @@ class GoalType extends AbstractType ->add('title', TranslatableStringFormType::class, [ 'label' => 'Nom', ]) - - ->add('socialActions', EntityType::class, [ - 'class' => SocialAction::class, - 'required' => false, - 'multiple' => true, - 'choice_label' => function (SocialAction $issue) { - return $this->translatableStringHelper->localize($issue->getTitle()); - }, - 'attr' => ['class' => 'select2 '], - ]) - ->add('results', EntityType::class, [ 'class' => Result::class, 'required' => false, @@ -63,7 +52,6 @@ class GoalType extends AbstractType }, 'attr' => ['class' => 'select2 '], ]) - ->add('desactivationDate', ChillDateType::class, [ 'required' => false, 'label' => 'goal.desactivationDate', diff --git a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig index 20f944595..14e9bab73 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/SocialWork/Goal/index.html.twig @@ -5,7 +5,6 @@ {% block table_entities_thead_tr %}