vue activity: fix backend when hidden return empty string

This commit is contained in:
Mathieu Jaumotte 2021-06-29 14:31:56 +02:00
parent 2a974e1269
commit 9d9be7f831
3 changed files with 10 additions and 8 deletions

View File

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

View File

@ -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')) {

View File

@ -64,7 +64,6 @@
{{ $t('activity.select_first_a_social_issue') }}
</span>
</div>
</div>