From 5e7445a4fe2b9d0f12380ca0c9837fe4547ff125 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 2 Dec 2021 15:31:38 +0100 Subject: [PATCH] stylefix --- .../Entity/AccompanyingPeriod.php | 29 +++++++++---------- .../AccompanyingPeriodConfidentialTest.php | 4 +-- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index e488edd79..51022a2f1 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -459,6 +459,20 @@ class AccompanyingPeriod implements return end($periods) === $this; } + /** + * @Assert\Callback + */ + public function canUserBeNull(ExecutionContextInterface $context) + { + if ($this->getStep() === self::STEP_CONFIRMED && $this->isConfidential() === true) { + if (!$this->getUser()) { + $context->buildViolation('User cannot be null for an accompanying period that is confirmed and confidential') + ->atPath('user') + ->addViolation(); + } + } + } + /** * Close a participation for a person. * @@ -871,21 +885,6 @@ class AccompanyingPeriod implements } } - /** - * @Assert\Callback - */ - public function canUserBeNull(ExecutionContextInterface $context) - { - if ($this->getStep() === self::STEP_CONFIRMED && $this->isConfidential() === true) - { - if (!$this->getUser()) { - $context->buildViolation('User cannot be null for an accompanying period that is confirmed and confidential') - ->atPath('user') - ->addViolation(); - } - } - } - public function isEmergency(): bool { return $this->emergency; diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php index 1986f67e9..558079414 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php @@ -9,10 +9,10 @@ namespace Chill\PersonBundle\Tests\AccompanyingPeriod; -use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\Scope; -use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; +use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Validator\Validator\ValidatorInterface;