diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index c212471be..fbd10e723 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -108,14 +108,14 @@ class Activity implements HasCenterInterface, HasScopeInterface * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue") * @Groups({"read"}) */ - private ?Collection $socialIssues = null; + private Collection $socialIssues; /** * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction") * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction") * @Groups({"read"}) */ - private ?Collection $socialActions = null; + private Collection $socialActions; /** * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType") @@ -298,9 +298,6 @@ class Activity implements HasCenterInterface, HasScopeInterface return $this; } - /** - * @return Collection|SocialAction[] - */ public function getSocialActions(): Collection { return $this->socialActions; diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 80d0991e7..3ad204f18 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -123,13 +123,16 @@ class ActivityType extends AbstractType return implode(',', $socialIssueIds); }, function (?string $socialIssuesAsString): array { + if (null === $socialIssuesAsString) { + return []; + } return array_map( fn(string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]), explode(',', $socialIssuesAsString) ); } )) - ; + ; } if ($activityType->isVisible('socialActions') && $accompanyingPeriod) { @@ -144,13 +147,16 @@ class ActivityType extends AbstractType return implode(',', $socialActionIds); }, function (?string $socialActionsAsString): array { + if (null === $socialActionsAsString) { + return []; + } return array_map( fn(string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]), explode(',', $socialActionsAsString) ); } )) - ; + ; } if ($activityType->isVisible('date')) { diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue index 4e1761814..154209cbf 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue @@ -64,7 +64,6 @@ {{ $t('activity.select_first_a_social_issue') }} -