This commit is contained in:
2022-04-26 21:16:55 +02:00
parent b2fb86111d
commit c2061110dd
3 changed files with 70 additions and 68 deletions

View File

@@ -35,7 +35,6 @@ 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 function count;
/**
* Class Activity.
@@ -238,23 +237,14 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return $this;
}
private function ensureSocialActionConsistency(): void
{
$ancestors = SocialAction::findAncestorSocialActions($this->getSocialActions());
foreach ($ancestors as $ancestor) {
$this->removeSocialAction($ancestor);
}
}
/**
* Add a social issue
* 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}
*
* @param SocialIssue $socialIssue
* @return $this
*/
public function addSocialIssue(SocialIssue $socialIssue): self
@@ -652,4 +642,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return $this;
}
private function ensureSocialActionConsistency(): void
{
$ancestors = SocialAction::findAncestorSocialActions($this->getSocialActions());
foreach ($ancestors as $ancestor) {
$this->removeSocialAction($ancestor);
}
}
}

View File

@@ -20,6 +20,10 @@ use Doctrine\ORM\Event\LifecycleEventArgs;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
/**
* @internal
* @coversNothing
*/
final class ActivityTest extends TestCase
{
use ProphecyTrait;
@@ -107,5 +111,4 @@ final class ActivityTest extends TestCase
$this->assertNotContains($parent, $activity->getSocialIssues());
$this->assertNotContains($child, $activity->getSocialIssues());
}
}