mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-30 18:39:43 +00:00
Apply rector rules: add annotation for doctrine mapping
This commit is contained in:
@@ -37,10 +37,10 @@ use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\LocationValidity
|
||||
use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlap;
|
||||
use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ResourceDuplicateCheck;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Common\Collections\Order;
|
||||
use Doctrine\Common\Collections\ReadableCollection;
|
||||
use Doctrine\Common\Collections\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@@ -54,8 +54,6 @@ use UnexpectedValueException;
|
||||
/**
|
||||
* AccompanyingPeriod Class.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*
|
||||
* @LocationValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
|
||||
@@ -136,13 +134,13 @@ class AccompanyingPeriod implements
|
||||
|
||||
#[Groups(['read', 'write'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)]
|
||||
#[ORM\ManyToOne(targetEntity: Location::class)]
|
||||
private ?Location $administrativeLocation = null;
|
||||
|
||||
/**
|
||||
* @var Collection&Selectable<int, Calendar>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \Chill\CalendarBundle\Entity\Calendar::class, mappedBy: 'accompanyingPeriod')]
|
||||
#[ORM\OneToMany(targetEntity: Calendar::class, mappedBy: 'accompanyingPeriod')]
|
||||
private Collection&Selectable $calendars;
|
||||
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
@@ -151,21 +149,18 @@ class AccompanyingPeriod implements
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
|
||||
private ?\DateTime $closingDate = null;
|
||||
|
||||
|
||||
#[Groups(['read', 'write'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class)]
|
||||
#[ORM\ManyToOne(targetEntity: ClosingMotive::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?ClosingMotive $closingMotive = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var Collection<Comment>
|
||||
*/
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])]
|
||||
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\Comment::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['createdAt' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
|
||||
#[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['createdAt' => Order::Descending, 'id' => 'DESC'])]
|
||||
private Collection $comments;
|
||||
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
@@ -176,7 +171,6 @@ class AccompanyingPeriod implements
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
|
||||
private ?\DateTimeInterface $createdAt = null;
|
||||
|
||||
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
@@ -186,7 +180,6 @@ class AccompanyingPeriod implements
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
|
||||
private bool $emergency = false;
|
||||
|
||||
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
@@ -215,7 +208,6 @@ class AccompanyingPeriod implements
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)]
|
||||
private ?\DateTime $openingDate = null;
|
||||
|
||||
|
||||
#[Groups(['read', 'write'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
|
||||
#[ORM\ManyToOne(targetEntity: Origin::class)]
|
||||
@@ -223,8 +215,8 @@ class AccompanyingPeriod implements
|
||||
private ?Origin $origin = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*
|
||||
* @var Collection<AccompanyingPeriodParticipation>
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
@@ -234,7 +226,6 @@ class AccompanyingPeriod implements
|
||||
#[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'periodLocatedOn')]
|
||||
private ?Person $personLocation = null;
|
||||
|
||||
|
||||
#[Groups(['read'])]
|
||||
#[ORM\ManyToOne(targetEntity: Comment::class, cascade: ['persist'])]
|
||||
#[ORM\JoinColumn(onDelete: 'SET NULL')]
|
||||
@@ -250,12 +241,10 @@ class AccompanyingPeriod implements
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
|
||||
private bool $requestorAnonymous = false;
|
||||
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'accompanyingPeriodRequested')]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?Person $requestorPerson = null;
|
||||
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?ThirdParty $requestorThirdParty = null;
|
||||
@@ -263,17 +252,14 @@ class AccompanyingPeriod implements
|
||||
/**
|
||||
* @var Collection<resource>
|
||||
*
|
||||
*
|
||||
* @ResourceDuplicateCheck(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED, "Default", "default"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\Resource::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: AccompanyingPeriod\Resource::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
private Collection $resources;
|
||||
|
||||
/**
|
||||
* @var Collection<Scope>
|
||||
*
|
||||
*
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')]
|
||||
@@ -283,8 +269,6 @@ class AccompanyingPeriod implements
|
||||
|
||||
/**
|
||||
* @var Collection<SocialIssue>
|
||||
*
|
||||
*
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')]
|
||||
@@ -311,7 +295,6 @@ class AccompanyingPeriod implements
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
private ?User $updatedBy = null;
|
||||
|
||||
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
@@ -420,7 +403,7 @@ class AccompanyingPeriod implements
|
||||
|
||||
// ensure continuity of histories
|
||||
$criteria = new Criteria();
|
||||
$criteria->orderBy(['startDate' => \Doctrine\Common\Collections\Order::Ascending, 'id' => \Doctrine\Common\Collections\Order::Ascending]);
|
||||
$criteria->orderBy(['startDate' => Order::Ascending, 'id' => Order::Ascending]);
|
||||
|
||||
/** @var \Iterator $locations */
|
||||
$locations = $this->getLocationHistories()->matching($criteria)->getIterator();
|
||||
@@ -1383,7 +1366,7 @@ class AccompanyingPeriod implements
|
||||
{
|
||||
// ensure continuity of histories
|
||||
$criteria = new Criteria();
|
||||
$criteria->orderBy(['startDate' => \Doctrine\Common\Collections\Order::Ascending, 'id' => \Doctrine\Common\Collections\Order::Ascending]);
|
||||
$criteria->orderBy(['startDate' => Order::Ascending, 'id' => Order::Ascending]);
|
||||
|
||||
/** @var \Iterator $steps */
|
||||
$steps = $this->getStepHistories()->matching($criteria)->getIterator();
|
||||
|
Reference in New Issue
Block a user