Apply rector rules: symfony up to 54

This commit is contained in:
2024-04-04 23:30:25 +02:00
parent 1ee3b9e2f0
commit 579bd829f8
204 changed files with 974 additions and 2346 deletions

View File

@@ -33,23 +33,16 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_work")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "accompanying_period_work": AccompanyingPeriodWork::class
* }
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work' => AccompanyingPeriodWork::class])]
class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*
* @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"})
*
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])]
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
@@ -60,57 +53,46 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* orphanRemoval=true
* )
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @ORM\OrderBy({"startDate": "DESC", "id": "DESC"})
*
* @var Collection<AccompanyingPeriodWorkEvaluation>
*
* @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private Collection $accompanyingPeriodWorkEvaluations;
/**
* @ORM\Column(type="datetime_immutable")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\Column(type="boolean")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private bool $createdAutomatically = false;
/**
* @ORM\Column(type="text")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private string $createdAutomaticallyReason = '';
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private ?User $createdBy = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"accompanying_period_work:create"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*
* @Assert\GreaterThanOrEqual(propertyPath="startDate",
* message="accompanying_course_work.The endDate should be greater or equal than the start date"
* )
*/
#[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'accompanying_course_work.The endDate should be greater or equal than the start date')]
private ?\DateTimeImmutable $endDate = null;
/**
@@ -122,20 +104,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* cascade={"persist"},
* orphanRemoval=true
* )
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work:edit"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
private Collection $goals;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work:edit"})
*
* In schema : traitant
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
private ?ThirdParty $handlingThierParty = null;
/**
@@ -144,16 +120,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light", "read:evaluation:include-work"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'read:evaluation:include-work'])]
private ?int $id = null;
/**
* @ORM\Column(type="text")
*
* @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"})
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit', 'docgen:read'])]
private string $note = '';
/**
@@ -162,18 +136,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\ManyToMany(targetEntity=Person::class)
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"accompanying_period_work:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])]
private Collection $persons;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
*
* @Serializer\Groups({"read", "accompanying_period_work:edit"})
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
private PrivateCommentEmbeddable $privateComment;
/**
@@ -189,29 +159,22 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work:edit"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
private Collection $results;
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class)
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Serializer\Groups({"accompanying_period_work:create"})
*
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:create'])]
private ?SocialAction $socialAction = null;
/**
* @ORM\Column(type="date_immutable")
*
* @Serializer\Groups({"accompanying_period_work:create"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
private ?\DateTimeImmutable $startDate = null;
/**
@@ -222,35 +185,30 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
*
* In schema : intervenants
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work:edit"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
private Collection $thirdParties;
/**
* @ORM\Column(type="datetime_immutable")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?User $updatedBy = null;
/**
* @ORM\Column(type="integer", nullable=false, options={"default": 1})
*
* @Serializer\Groups({"read", "accompanying_period_work:edit"})
*
* @ORM\Version
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
private int $version = 1;
public function __construct()
@@ -394,11 +352,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
/**
* @return ReadableCollection<int, User>
*
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"accompanying_period_work:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])]
public function getReferrers(): ReadableCollection
{
$users = $this->referrersHistory

View File

@@ -25,11 +25,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_work_evaluation")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_work_evaluation": AccompanyingPeriodWorkEvaluation::class,
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation' => AccompanyingPeriodWorkEvaluation::class])]
class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface
{
/**
@@ -38,35 +35,29 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
* inversedBy="accompanyingPeriodWorkEvaluations"
* )
*
* @Serializer\Groups({"read:evaluation:include-work"})
*
* @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"})
*/
#[Serializer\Groups(['read:evaluation:include-work'])]
private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private string $comment = '';
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?User $createdBy = null;
/**
@@ -83,29 +74,23 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
*
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
*
* @Serializer\Groups({"read"})
*
* @var Collection<AccompanyingPeriodWorkEvaluationDocument>
*/
#[Serializer\Groups(['read'])]
private Collection $documents;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(
* targetEntity=Evaluation::class
* )
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work_evaluation:create'])]
private ?Evaluation $evaluation = null;
/**
@@ -114,9 +99,8 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
@@ -125,63 +109,46 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
*
* This data is not persisted into database, but will appears on the data
* normalized during the same request (like PUT/PATCH request)
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private $key;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?\DateTimeImmutable $maxDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?User $updatedBy = null;
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?\DateInterval $warningInterval = null;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Serializer\Groups({"read", "docgen:read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?int $timeSpent = null;
public function __construct()
@@ -270,9 +237,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
return $this->updatedBy;
}
/**
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
public function getWarningDate(): ?\DateTimeImmutable
{
if (null === $this->getEndDate() || null === $this->getWarningInterval()) {

View File

@@ -23,11 +23,8 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_work_evaluation_document")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_work_evaluation_document": AccompanyingPeriodWorkEvaluationDocument::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_evaluation_document' => AccompanyingPeriodWorkEvaluationDocument::class])]
class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doctrine\Model\TrackCreationInterface, \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface
{
use TrackCreationTrait;
@@ -52,10 +49,8 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
* @internal the default name exceeds 64 characters, we must set manually:
*
* @ORM\SequenceGenerator(sequenceName="chill_person_social_work_eval_doc_id_seq", allocationSize=1, initialValue=1000)
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])]
private ?int $id = null;
/**
@@ -64,43 +59,31 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
*
* This data is not persisted into database, but will appears on the data
* normalized during the same request (like PUT/PATCH request)
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private $key;
/**
* @ORM\ManyToOne(
* targetEntity=StoredObject::class,
* )
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*
* @Assert\Valid
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
#[Assert\Valid]
private ?StoredObject $storedObject = null;
/**
* @ORM\ManyToOne(
* targetEntity=DocGeneratorTemplate::class
* )
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])]
private ?DocGeneratorTemplate $template = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private ?string $title = '';
public function getAccompanyingPeriodWorkEvaluation(): ?AccompanyingPeriodWorkEvaluation

View File

@@ -22,14 +22,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_work_goal")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "accompanying_period_work_goal": AccompanyingPeriodWorkGoal::class
* }
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_work_goal' => AccompanyingPeriodWorkGoal::class])]
class AccompanyingPeriodWorkGoal
{
/**
@@ -39,10 +33,8 @@ class AccompanyingPeriodWorkGoal
/**
* @ORM\ManyToOne(targetEntity=Goal::class)
*
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
private ?Goal $goal = null;
/**
@@ -51,17 +43,14 @@ class AccompanyingPeriodWorkGoal
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="text")
*
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read'])]
private string $note = '';
/**
@@ -70,10 +59,8 @@ class AccompanyingPeriodWorkGoal
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
*
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
private Collection $results;
public function __construct()

View File

@@ -47,18 +47,16 @@ class ClosingMotive
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private array $name = [];
/**

View File

@@ -24,11 +24,8 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_comment")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_comment": Comment::class
* })
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_comment' => Comment::class])]
class Comment implements TrackCreationInterface, TrackUpdateInterface
{
/**
@@ -42,29 +39,24 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="text", nullable=false, options={"default":""})
*
* @Groups({"read", "write", "docgen:read"})
*
* @Assert\NotBlank
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank]
#[Assert\NotNull]
private string $content = '';
/**
* @ORM\Column(type="datetime")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?User $creator = null;
/**
@@ -73,25 +65,22 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="datetime")
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?\DateTimeInterface $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?User $updatedBy = null;
public function getAccompanyingPeriod(): ?AccompanyingPeriod

View File

@@ -18,13 +18,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_origin")
*
* @Serializer\DiscriminatorMap(
* typeProperty="type",
* mapping={
* "origin": Origin::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['origin' => Origin::class])]
class Origin
{
/**
@@ -33,25 +28,22 @@ class Origin
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private array $label = [];
/**
* @ORM\Column(type="date_immutable", nullable=true)
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?\DateTimeImmutable $noActiveAfter = null;
public function getId(): ?int

View File

@@ -31,11 +31,12 @@ use Symfony\Component\Serializer\Annotation\Groups;
* @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"})
* }
* )
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_resource": Resource::class
* })
* @ORM\UniqueConstraint(name="person_unique", columns={"person_id", "accompanyingperiod_id"}),
* @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"})
* }
* )
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_resource' => Resource::class])]
class Resource
{
/**
@@ -50,9 +51,8 @@ class Resource
/**
* @ORM\Column(type="text", nullable=true)
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?string $comment = '';
/**
@@ -61,27 +61,24 @@ class Resource
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?ThirdParty $thirdParty = null;
public function getAccompanyingPeriod(): ?AccompanyingPeriod
@@ -104,9 +101,7 @@ class Resource
return $this->person;
}
/**
* @Groups({"read"})
*/
#[Groups(['read'])]
public function getResource(): Person|ThirdParty|null
{
return $this->person ?? $this->thirdParty;