Apply rector rules: add annotation for doctrine mapping

This commit is contained in:
2024-04-05 00:01:30 +02:00
parent 579bd829f8
commit 72016e1a21
124 changed files with 1724 additions and 3770 deletions

View File

@@ -25,64 +25,59 @@ use Doctrine\ORM\Mapping as ORM;
*
* - get the user involved with an accompanying period
*
* @ORM\Entity()
*
* @ORM\Table(name="view_chill_person_accompanying_period_info")
*/
#[ORM\Entity]
#[ORM\Table(name: 'view_chill_person_accompanying_period_info')]
class AccompanyingPeriodInfo
{
public function __construct(
/**
* @var AccompanyingPeriod
*
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*/
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
public readonly AccompanyingPeriod $accompanyingPeriod,
/**
* @var string
*
* @ORM\Column(type="text")
*
* @ORM\Id
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
#[ORM\Id]
public readonly string $relatedEntity,
/**
* @var int
*
* @ORM\Column(type="integer")
*
* @ORM\Id
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\Id]
public readonly int $relatedEntityId,
/**
* @var User
*
* @ORM\ManyToOne(targetEntity=User::class)
*/
#[ORM\ManyToOne(targetEntity: User::class)]
public readonly ?User $user,
/**
* @var \DateTimeImmutable
*
* @ORM\Column(type="datetime_immutable")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
public readonly \DateTimeImmutable $infoDate,
/**
* @var array
*
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
public readonly array $metadata,
/**
* @var string
*
* @ORM\Column(type="text")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
public readonly string $discriminator,
) {}
}

View File

@@ -18,47 +18,32 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_location_history")
*/
#[ORM\Entity]
#[ORM\Table('chill_person_accompanying_period_location_history')]
class AccompanyingPeriodLocationHistory implements TrackCreationInterface
{
use TrackCreationTrait;
/**
* @ORM\ManyToOne(targetEntity=Address::class, cascade={"persist"})
*/
#[ORM\ManyToOne(targetEntity: Address::class, cascade: ['persist'])]
private ?Address $addressLocation = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*/
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
private AccompanyingPeriod $period;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*/
#[ORM\ManyToOne(targetEntity: Person::class)]
private ?Person $personLocation = null;
/**
* @ORM\Column(type="date_immutable")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $startDate = null;
public function getAddressLocation(): ?Address

View File

@@ -19,51 +19,36 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_step_history")
*/
#[ORM\Entity]
#[ORM\Table('chill_person_accompanying_period_step_history')]
class AccompanyingPeriodStepHistory implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*/
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
private AccompanyingPeriod $period;
/**
* @ORM\Column(type="date_immutable")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="text", nullable=false)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)]
private string $step;
/**
* @ORM\ManyToOne(targetEntity=ClosingMotive::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: ClosingMotive::class)]
#[ORM\JoinColumn(nullable: true)]
private ?ClosingMotive $closingMotive = null;
public function getEndDate(): ?\DateTimeImmutable

View File

@@ -29,186 +29,141 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
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])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_work')]
class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
*
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'read:accompanyingPeriodWork:light'])]
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class)]
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkEvaluation::class,
* mappedBy="accompanyingPeriodWork",
* cascade={"remove", "persist"},
* orphanRemoval=true
* )
*
* @ORM\OrderBy({"startDate": "DESC", "id": "DESC"})
*
* @var Collection<AccompanyingPeriodWorkEvaluation>
*
* @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkEvaluation::class, mappedBy: 'accompanyingPeriodWork', cascade: ['remove', 'persist'], orphanRemoval: true)]
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $accompanyingPeriodWorkEvaluations;
/**
* @ORM\Column(type="datetime_immutable")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $createdAutomatically = false;
/**
* @ORM\Column(type="text")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $createdAutomaticallyReason = '';
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $createdBy = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[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')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null;
/**
* @var Collection<AccompanyingPeriodWorkGoal>
*
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkGoal::class,
* mappedBy="accompanyingPeriodWork",
* cascade={"persist"},
* orphanRemoval=true
* )
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkGoal::class, mappedBy: 'accompanyingPeriodWork', cascade: ['persist'], orphanRemoval: true)]
private Collection $goals;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
private ?ThirdParty $handlingThierParty = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'read:evaluation:include-work'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="text")
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $note = '';
/**
* @var Collection<Person>
*
* @ORM\ManyToMany(targetEntity=Person::class)
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])]
#[ORM\ManyToMany(targetEntity: Person::class)]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_person')]
private Collection $persons;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')]
private PrivateCommentEmbeddable $privateComment;
/**
* @var Collection<int, AccompanyingPeriodWorkReferrerHistory>
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriodWorkReferrerHistory::class, cascade={"persist", "remove"}, mappedBy="accompanyingPeriodWork", orphanRemoval=true)
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkReferrerHistory::class, cascade: ['persist', 'remove'], mappedBy: 'accompanyingPeriodWork', orphanRemoval: true)]
private Collection $referrersHistory;
/**
* @var Collection<Result>
*
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'accompanyingPeriodWorks')]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_result')]
private Collection $results;
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class)
*
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:create'])]
#[ORM\ManyToOne(targetEntity: SocialAction::class)]
private ?SocialAction $socialAction = null;
/**
* @ORM\Column(type="date_immutable")
*/
#[Serializer\Groups(['accompanying_period_work:create', 'accompanying_period_work:edit', 'read', 'docgen:read', 'read:accompanyingPeriodWork:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $startDate = null;
/**
* @var Collection<ThirdParty>
*
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
*
* In schema : intervenants
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\ManyToMany(targetEntity: ThirdParty::class)]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_third_party')] // In schema : intervenants
private Collection $thirdParties;
/**
* @ORM\Column(type="datetime_immutable")
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $updatedBy = null;
/**
* @ORM\Column(type="integer", nullable=false, options={"default": 1})
*
* @ORM\Version
*/
#[Serializer\Groups(['read', 'accompanying_period_work:edit'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 1])]
#[ORM\Version]
private int $version = 1;
public function __construct()

View File

@@ -21,43 +21,29 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
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])]
#[ORM\Entity]
#[ORM\Table('chill_person_accompanying_period_work_evaluation')]
class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\ManyToOne(
* targetEntity=AccompanyingPeriodWork::class,
* inversedBy="accompanyingPeriodWorkEvaluations"
* )
*
* @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"})
*/
#[Serializer\Groups(['read:evaluation:include-work'])]
#[ORM\ManyToOne(targetEntity: AccompanyingPeriodWork::class, inversedBy: 'accompanyingPeriodWorkEvaluations')]
private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $comment = '';
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $createdBy = null;
/**
@@ -65,42 +51,28 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
*
* @see{Chill\PersonBundle\Serializer\Normalizer\AccompanyingPeriodWorkEvaluationDenormalizer}
*
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkEvaluationDocument::class,
* mappedBy="accompanyingPeriodWorkEvaluation",
* cascade={"remove", "persist"},
* orphanRemoval=true
* )
*
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
*
* @var Collection<AccompanyingPeriodWorkEvaluationDocument>
*/
#[Serializer\Groups(['read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkEvaluationDocument::class, mappedBy: 'accompanyingPeriodWorkEvaluation', cascade: ['remove', 'persist'], orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $documents;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(
* targetEntity=Evaluation::class
* )
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work_evaluation:create'])]
#[ORM\ManyToOne(targetEntity: Evaluation::class)]
private ?Evaluation $evaluation = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
@@ -113,42 +85,28 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
#[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', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $maxDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $updatedBy = null;
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATEINTERVAL, nullable: true, options: ['default' => null])]
private ?\DateInterval $warningInterval = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
#[Serializer\Groups(['read', 'docgen:read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)]
private ?int $timeSpent = null;
public function __construct()

View File

@@ -19,38 +19,31 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
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])]
#[ORM\Entity]
#[ORM\Table('chill_person_accompanying_period_work_evaluation_document')]
class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doctrine\Model\TrackCreationInterface, \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
/**
* @ORM\ManyToOne(
* targetEntity=AccompanyingPeriodWorkEvaluation::class,
* inversedBy="documents"
* )
*/
#[ORM\ManyToOne(targetEntity: AccompanyingPeriodWorkEvaluation::class, inversedBy: 'documents')]
private ?AccompanyingPeriodWorkEvaluation $accompanyingPeriodWorkEvaluation = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @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', 'accompanying_period_work_evaluation:create'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\SequenceGenerator(sequenceName: 'chill_person_social_work_eval_doc_id_seq', allocationSize: 1, initialValue: 1000)]
private ?int $id = null;
/**
@@ -63,27 +56,17 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
private $key;
/**
* @ORM\ManyToOne(
* targetEntity=StoredObject::class,
* )
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
#[Assert\Valid]
#[ORM\ManyToOne(targetEntity: StoredObject::class)]
private ?StoredObject $storedObject = null;
/**
* @ORM\ManyToOne(
* targetEntity=DocGeneratorTemplate::class
* )
*/
#[Serializer\Groups(['read', 'accompanying_period_work_evaluation:create'])]
#[ORM\ManyToOne(targetEntity: DocGeneratorTemplate::class)]
private ?DocGeneratorTemplate $template = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[Serializer\Groups(['read', 'write', 'accompanying_period_work_evaluation:create'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private ?string $title = '';
public function getAccompanyingPeriodWorkEvaluation(): ?AccompanyingPeriodWorkEvaluation

View File

@@ -18,49 +18,38 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
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])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_work_goal')]
class AccompanyingPeriodWorkGoal
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriodWork::class, inversedBy="goals")
*/
#[ORM\ManyToOne(targetEntity: AccompanyingPeriodWork::class, inversedBy: 'goals')]
private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;
/**
* @ORM\ManyToOne(targetEntity=Goal::class)
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: Goal::class)]
private ?Goal $goal = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="text")
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $note = '';
/**
* @var Collection<Result>
*
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
*
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'accompanyingPeriodWorkGoals')]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_work_goal_result')]
private Collection $results;
public function __construct()

View File

@@ -18,46 +18,35 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_work_referrer")
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_work_referrer')]
class AccompanyingPeriodWorkReferrerHistory implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null;
public function __construct(
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriodWork::class, inversedBy="referrersHistory")
*/
#[ORM\ManyToOne(targetEntity: AccompanyingPeriodWork::class, inversedBy: 'referrersHistory')]
private ?AccompanyingPeriodWork $accompanyingPeriodWork,
/**
* @var User
*
* @ORM\ManyToOne(targetEntity=User::class)
*/
#[ORM\ManyToOne(targetEntity: User::class)]
private User $user,
/**
* @var \DateTimeImmutable
*
* @ORM\Column(type="date_immutable", nullable=false)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
private \DateTimeImmutable $startDate
) {}

View File

@@ -19,61 +19,44 @@ use Symfony\Component\Serializer\Annotation as Serializer;
/**
* ClosingMotive give an explanation why we closed the Accompanying period.
*
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_closingmotive")
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_closingmotive')]
class ClosingMotive
{
/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
/**
* Child Accompanying periods.
*
* @var Collection<ClosingMotive>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* mappedBy="parent")
*/
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class, mappedBy: 'parent')]
private Collection $children;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = [];
/**
* @ORM\Column(type="float")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
private float $ordering = 0.0;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* inversedBy="children")
*/
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class, inversedBy: 'children')]
private ?ClosingMotive $parent = null;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => false])]
private bool $isCanceledAccompanyingPeriod = false;
/**

View File

@@ -20,67 +20,48 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups;
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])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_comment')]
class Comment implements TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod",
* inversedBy="comments")
*
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class, inversedBy: 'comments')]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default":""})
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank]
#[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $content = '';
/**
* @ORM\Column(type="datetime")
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $creator = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="datetime")
*/
#[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $updatedBy = null;
public function getAccompanyingPeriod(): ?AccompanyingPeriod

View File

@@ -14,36 +14,28 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM;
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])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_origin')]
class Origin
{
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $label = [];
/**
* @ORM\Column(type="date_immutable", nullable=true)
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $noActiveAfter = null;
public function getId(): ?int

View File

@@ -21,64 +21,44 @@ use Symfony\Component\Serializer\Annotation\Groups;
/**
* **About denormalization**: this operation is operated by @see{AccompanyingPeriodResourdeNormalizer}.
*
* @ORM\Entity
*
* @ORM\Table(
* name="chill_person_accompanying_period_resource",
* uniqueConstraints={
*
* @ORM\UniqueConstraint(name="person_unique", columns={"person_id", "accompanyingperiod_id"}),
* @ORM\UniqueConstraint(name="thirdparty_unique", columns={"thirdparty_id", "accompanyingperiod_id"})
* }
* )
* @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])]
#[ORM\Entity]
#[ORM\UniqueConstraint(name: 'person_unique', columns: ['person_id', 'accompanyingperiod_id'])] // ,
#[ORM\UniqueConstraint(name: 'thirdparty_unique', columns: ['thirdparty_id', 'accompanyingperiod_id'])]
#[ORM\Table(name: 'chill_person_accompanying_period_resource')]
#[ORM\UniqueConstraint(name: 'person_unique', columns: ['person_id', 'accompanyingperiod_id'])]
#[ORM\UniqueConstraint(name: 'thirdparty_unique', columns: ['thirdparty_id', 'accompanyingperiod_id'])]
class Resource
{
/**
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod",
* inversedBy="resources"
* )
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod::class, inversedBy: 'resources')]
#[ORM\JoinColumn(nullable: false)]
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $comment = '';
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
#[ORM\JoinColumn(nullable: true)]
private ?ThirdParty $thirdParty = null;
public function getAccompanyingPeriod(): ?AccompanyingPeriod

View File

@@ -17,46 +17,33 @@ use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*
* @ORM\Table("chill_person_accompanying_period_user_history")
*/
#[ORM\Entity]
#[ORM\Table('chill_person_accompanying_period_user_history')]
class UserHistory implements TrackCreationInterface
{
use TrackCreationTrait;
/**
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
public function __construct(
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="userHistories")
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class, inversedBy: 'userHistories')]
#[ORM\JoinColumn(nullable: false)]
private ?AccompanyingPeriod $accompanyingPeriod,
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private User $user,
/**
* @ORM\Column(type="datetime_immutable", nullable=false, options={"default": "now()"})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false, options: ['default' => 'now()'])]
private \DateTimeImmutable $startDate = new \DateTimeImmutable('now')
) {}