mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
merge master into branch
This commit is contained in:
@@ -36,6 +36,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Serializer\Annotation\SerializedName;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Class Activity.
|
||||
@@ -100,6 +101,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
|
||||
* @Assert\Valid(traverse=true)
|
||||
*/
|
||||
private Collection $documents;
|
||||
|
||||
@@ -239,11 +241,22 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
{
|
||||
if (!$this->socialActions->contains($socialAction)) {
|
||||
$this->socialActions[] = $socialAction;
|
||||
$this->ensureSocialActionConsistency();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a social issue.
|
||||
*
|
||||
* Note: the social issue consistency (the fact that only yougest social issues
|
||||
* are kept) is processed by an entity listener:
|
||||
*
|
||||
* @see{\Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener}
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addSocialIssue(SocialIssue $socialIssue): self
|
||||
{
|
||||
if (!$this->socialIssues->contains($socialIssue)) {
|
||||
@@ -651,4 +664,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function ensureSocialActionConsistency(): void
|
||||
{
|
||||
$ancestors = SocialAction::findAncestorSocialActions($this->getSocialActions());
|
||||
|
||||
foreach ($ancestors as $ancestor) {
|
||||
$this->removeSocialAction($ancestor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user