vue activity: fix duplicates and add condition in initial loading

This commit is contained in:
2021-06-29 11:49:23 +02:00
parent b705c5910f
commit beca41774e
3 changed files with 42 additions and 37 deletions

View File

@@ -108,15 +108,14 @@ class Activity implements HasCenterInterface, HasScopeInterface
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
* @Groups({"read"})
*/
private $socialIssues;
private ?Collection $socialIssues = null;
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
* @Groups({"read"})
*/
private $socialActions;
private ?Collection $socialActions = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
@@ -283,7 +282,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this->socialIssues;
}
public function addSocialIssue(SocialIssue $socialIssue): self
public function addSocialIssue(?SocialIssue $socialIssue): self
{
if (!$this->socialIssues->contains($socialIssue)) {
$this->socialIssues[] = $socialIssue;
@@ -307,7 +306,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this->socialActions;
}
public function addSocialAction(SocialAction $socialAction): self
public function addSocialAction(?SocialAction $socialAction): self
{
if (!$this->socialActions->contains($socialAction)) {
$this->socialActions[] = $socialAction;