mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
fixes
This commit is contained in:
@@ -38,6 +38,7 @@ use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use JsonSchema\Exception\ValidationException;
|
||||
use LogicException;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
@@ -59,11 +60,6 @@ use const SORT_REGULAR;
|
||||
* "accompanying_period": AccompanyingPeriod::class
|
||||
* })
|
||||
* @Assert\GroupSequenceProvider
|
||||
* @Assert\Expression(
|
||||
* "this.isConfidential and this.getUser === NULL",
|
||||
* message="If the accompanying course is confirmed and confidential, a referrer must remain assigned."
|
||||
* )
|
||||
*
|
||||
* @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*/
|
||||
class AccompanyingPeriod implements
|
||||
@@ -340,6 +336,9 @@ class AccompanyingPeriod implements
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
* @Assert\Expression("!this.isConfidential() or (this.isConfidential() and value != null)",
|
||||
* groups={AccompanyingPeriod::STEP_CONFIRMED},
|
||||
* message="Referrer cannot be null for a confidential parcours")
|
||||
*/
|
||||
private ?User $user = null;
|
||||
|
||||
@@ -500,20 +499,6 @@ 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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user