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

@@ -54,9 +54,7 @@ use UnexpectedValueException;
/**
* AccompanyingPeriod Class.
*
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period")
*
* @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
*
@@ -66,6 +64,8 @@ use UnexpectedValueException;
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period' => AccompanyingPeriod::class])]
#[Assert\GroupSequenceProvider]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period')]
class AccompanyingPeriod implements
GroupSequenceProviderInterface,
HasCentersInterface,
@@ -131,285 +131,196 @@ class AccompanyingPeriod implements
*/
final public const STEP_DRAFT = 'DRAFT';
/**
* @ORM\ManyToOne(
* targetEntity=Address::class
* )
*/
#[ORM\ManyToOne(targetEntity: Address::class)]
private ?Address $addressLocation = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
*/
#[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Location::class)]
private ?Location $administrativeLocation = null;
/**
* @var Collection&Selectable<int, Calendar>
*
* @ORM\OneToMany(targetEntity="Chill\CalendarBundle\Entity\Calendar", mappedBy="accompanyingPeriod")
*/
#[ORM\OneToMany(targetEntity: \Chill\CalendarBundle\Entity\Calendar::class, mappedBy: 'accompanyingPeriod')]
private Collection&Selectable $calendars;
/**
* @ORM\Column(type="date", nullable=true)
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
#[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $closingDate = null;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class)]
#[ORM\JoinColumn(nullable: true)]
private ?ClosingMotive $closingMotive = null;
/**
* @ORM\OneToMany(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Comment",
* mappedBy="accompanyingPeriod",
* cascade={"persist", "remove"},
* orphanRemoval=true
* )
*
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
*
* @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'])]
private Collection $comments;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $confidential = false;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
#[Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true)]
private ?User $createdBy = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $emergency = false;
/**
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[Groups(['read', '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="string", nullable=true)
*/
#[Groups(['read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
private ?string $intensity = self::INTENSITY_OCCASIONAL;
/**
* @ORM\ManyToOne(
* targetEntity=UserJob::class
* )
*/
#[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\ManyToOne(targetEntity: UserJob::class)]
private ?UserJob $job = null;
/**
* @var Collection<AccompanyingPeriodLocationHistory>
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriodLocationHistory::class,
* mappedBy="period", cascade={"persist", "remove"}, orphanRemoval=true)
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodLocationHistory::class, mappedBy: 'period', cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $locationHistories;
/**
* @ORM\Column(type="date")
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\LessThan(value: 'tomorrow', groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[Assert\LessThanOrEqual(propertyPath: 'closingDate', groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)]
private ?\DateTime $openingDate = null;
/**
* @ORM\ManyToOne(targetEntity=Origin::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'write'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
#[ORM\ManyToOne(targetEntity: Origin::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Origin $origin = null;
/**
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
* mappedBy="accompanyingPeriod", orphanRemoval=true,
* cascade={"persist", "refresh", "remove", "merge", "detach"})
*
* @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
*
* @var Collection<AccompanyingPeriodParticipation>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodParticipation::class, mappedBy: 'accompanyingPeriod', orphanRemoval: true, cascade: ['persist', 'refresh', 'remove', 'merge', 'detach'])]
private Collection $participations;
/**
* @ORM\ManyToOne(
* targetEntity=Person::class,
* inversedBy="periodLocatedOn"
* )
*/
#[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'periodLocatedOn')]
private ?Person $personLocation = null;
/**
* @ORM\ManyToOne(
* targetEntity=Comment::class,
* cascade={"persist"},
* )
*
* @ORM\JoinColumn(onDelete="SET NULL")
*/
#[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: Comment::class, cascade: ['persist'])]
#[ORM\JoinColumn(onDelete: 'SET NULL')]
private ?Comment $pinnedComment = null;
private bool $preventUserIsChangedNotification = false;
/**
* @ORM\Column(type="text")
*/
#[Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $remark = '';
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[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)
*/
#[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'accompanyingPeriodRequested')]
#[ORM\JoinColumn(nullable: true)]
private ?Person $requestorPerson = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
#[ORM\JoinColumn(nullable: true)]
private ?ThirdParty $requestorThirdParty = null;
/**
* @var Collection<resource>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Resource",
* mappedBy="accompanyingPeriod",
* cascade={"persist", "remove"},
* orphanRemoval=true
* )
*
* @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)]
private Collection $resources;
/**
* @var Collection<Scope>
*
* @ORM\ManyToMany(
* targetEntity=Scope::class,
* cascade={}
* )
*
* @ORM\JoinTable(
* name="accompanying_periods_scopes",
* joinColumns={@ORM\JoinColumn(name="accompanying_period_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")}
* )
*/
#[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')]
#[ORM\ManyToMany(targetEntity: Scope::class, cascade: [])]
#[ORM\JoinTable(name: 'accompanying_periods_scopes', joinColumns: [new ORM\JoinColumn(name: 'accompanying_period_id', referencedColumnName: 'id')], inverseJoinColumns: [new ORM\JoinColumn(name: 'scope_id', referencedColumnName: 'id')])]
private Collection $scopes;
/**
* @var Collection<SocialIssue>
*
* @ORM\ManyToMany(
* targetEntity=SocialIssue::class
* )
*
* @ORM\JoinTable(
* name="chill_person_accompanying_period_social_issues"
* )
*/
#[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')]
#[ORM\ManyToMany(targetEntity: SocialIssue::class)]
#[ORM\JoinTable(name: 'chill_person_accompanying_period_social_issues')]
private Collection $socialIssues;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*
* @var AccompanyingPeriod::STEP_*
*/
#[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 32, nullable: true)]
private ?string $step = self::STEP_DRAFT;
/**
* @var Collection<AccompanyingPeriodStepHistory>
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriodStepHistory::class,
* mappedBy="period", cascade={"persist", "remove"}, orphanRemoval=true)
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodStepHistory::class, mappedBy: 'period', cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $stepHistories;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeInterface $updatedAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $updatedBy = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'write', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true)]
private ?User $user = null;
/**
* @ORM\OneToMany(targetEntity=UserHistory::class, mappedBy="accompanyingPeriod", orphanRemoval=true,
* cascade={"persist", "remove"})
*
* @var Collection<UserHistory>
*/
#[ORM\OneToMany(targetEntity: UserHistory::class, mappedBy: 'accompanyingPeriod', orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $userHistories;
private bool $userIsChanged = false;
@@ -423,13 +334,9 @@ class AccompanyingPeriod implements
/**
* @var Collection<AccompanyingPeriodWork>
*
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWork::class,
* mappedBy="accompanyingPeriod"
* )
*/
#[Assert\Valid(traverse: true)]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWork::class, mappedBy: 'accompanyingPeriod')]
private Collection $works;
/**

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')
) {}

View File

@@ -18,46 +18,33 @@ use Symfony\Component\Serializer\Annotation\Groups;
/**
* AccompanyingPeriodParticipation Class.
*
* @ORM\Entity
*
* @ORM\Table(name="chill_person_accompanying_period_participation")
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period_participation' => AccompanyingPeriodParticipation::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_accompanying_period_participation')]
class AccompanyingPeriodParticipation
{
/**
* @ORM\Column(type="date", nullable=true)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $endDate = 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="date", nullable=false)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: false)]
private ?\DateTime $startDate = null;
public function __construct(/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations", cascade={"persist"})
*
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false)
*/
private ?AccompanyingPeriod $accompanyingPeriod, /**
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodParticipations")
*
* @ORM\JoinColumn(name="person_id", referencedColumnName="id", nullable=false)
*/
#[Groups(['read', 'docgen:read'])]
public function __construct(
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class, inversedBy: 'participations', cascade: ['persist'])]
#[ORM\JoinColumn(name: 'accompanyingperiod_id', referencedColumnName: 'id', nullable: false)]
private ?AccompanyingPeriod $accompanyingPeriod,
#[Groups(['read', 'docgen:read'])] #[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'accompanyingPeriodParticipations')] #[ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id', nullable: false)]
private ?Person $person
) {
$this->startDate = new \DateTime('now');

View File

@@ -26,15 +26,13 @@ use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="chill_person_household"
* )
*
* @MaxHolder(groups={"household_memberships"})
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household' => Household::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household')]
class Household
{
/**
@@ -42,68 +40,48 @@ class Household
*
* @var Collection<Address>
*
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\Address",
* cascade={"persist", "remove", "merge", "detach"})
*
* @ORM\JoinTable(name="chill_person_household_to_addresses")
*
* @ORM\OrderBy({"validFrom": "DESC", "id": "DESC"})
*/
#[Serializer\Groups(['write'])]
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\JoinTable(name: 'chill_person_household_to_addresses')]
#[ORM\OrderBy(['validFrom' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $addresses;
/**
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_members_")
*/
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_members_')]
private CommentEmbeddable $commentMembers;
/**
* @var Collection&Selectable<int, HouseholdComposition>
*
* @ORM\OneToMany(
* targetEntity=HouseholdComposition::class,
* mappedBy="household",
* orphanRemoval=true,
* cascade={"persist"}
* )
*
* @ORM\OrderBy({"startDate": "DESC"})
*/
#[Assert\Valid(traverse: true, groups: ['household_composition'])]
#[ORM\OneToMany(targetEntity: HouseholdComposition::class, mappedBy: 'household', orphanRemoval: true, cascade: ['persist'])]
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC])]
private Collection&Selectable $compositions;
/**
* @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;
/**
* @var Collection<HouseholdMember>
*
* @ORM\OneToMany(
* targetEntity=HouseholdMember::class,
* mappedBy="household"
* )
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: HouseholdMember::class, mappedBy: 'household')]
private Collection $members;
/**
* @ORM\Column(type="boolean", name="waiting_for_birth", options={"default": false})
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'waiting_for_birth', options: ['default' => false])]
private bool $waitingForBirth = false;
/**
* @ORM\Column(type="date_immutable", name="waiting_for_birth_date", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, name: 'waiting_for_birth_date', nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $waitingForBirthDate = null;
public function __construct()

View File

@@ -20,70 +20,51 @@ 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_household_composition"
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_composition')]
class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
/**
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
*/
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
private CommentEmbeddable $comment;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(targetEntity=Household::class, inversedBy="compositions")
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: Household::class, inversedBy: 'compositions')]
#[ORM\JoinColumn(nullable: false)]
private ?Household $household = null;
/**
* @ORM\ManyToOne(targetEntity=HouseholdCompositionType::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: HouseholdCompositionType::class)]
#[ORM\JoinColumn(nullable: false)]
private ?HouseholdCompositionType $householdCompositionType = 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="integer", nullable=true, options={"default": null})
*/
#[Assert\NotNull]
#[Assert\GreaterThanOrEqual(0, groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
private ?int $numberOfChildren = null;
/**
* @ORM\Column(type="date_immutable", nullable=false)
*/
#[Assert\NotNull(groups: ['Default', 'household_composition'])]
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $startDate = null;
public function __construct()

View File

@@ -14,37 +14,27 @@ namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="chill_person_household_composition_type"
* )
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_composition_type')]
class HouseholdCompositionType
{
/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
/**
* @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 = [];
public function getId(): ?int

View File

@@ -16,81 +16,55 @@ 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_household_members"
* )
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_members')]
class HouseholdMember
{
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
private ?string $comment = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\GreaterThanOrEqual(propertyPath: 'startDate', message: 'household_membership.The end date must be after start date', groups: ['household_memberships'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private bool $holder = false;
/**
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Household\Household"
* )
*/
#[Assert\Valid(groups: ['household_memberships'])]
#[Assert\NotNull(groups: ['household_memberships'])]
#[ORM\ManyToOne(targetEntity: Household::class)]
private ?Household $household = 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\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
*
* @Serializer\Context({"docgen:person:with-household": false})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\Valid(groups: ['household_memberships'])]
#[Assert\NotNull(groups: ['household_memberships'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
private ?Person $person = null;
/**
* @ORM\ManyToOne(targetEntity=Position::class)
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: Position::class)]
private ?Position $position = null;
/**
* @ORM\Column(type="boolean", name="sharedhousehold")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'sharedhousehold')]
private bool $shareHousehold = true;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\NotNull(groups: ['household_memberships'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $startDate = null;
public function getComment(): ?string

View File

@@ -39,47 +39,34 @@ use Doctrine\ORM\Mapping as ORM;
* 2. 2st entity: from 2021-06-01 to 2021-12-01, household W, address R;
* 3. 3st entity: from 2021-12-01 to NULL, household V, address T;
*
* @ORM\Entity(readOnly=true)
*
* @ORM\Table(name="view_chill_person_household_address")
*/
#[ORM\Entity(readOnly: true)]
#[ORM\Table(name: 'view_chill_person_household_address')]
class PersonHouseholdAddress
{
/**
* @ORM\Id
*
* @ORM\ManyToOne(targetEntity=Address::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: Address::class)]
#[ORM\JoinColumn(nullable: false)]
private ?Address $address = null;
/**
* @ORM\Id
*
* @ORM\ManyToOne(targetEntity=Household::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: Household::class)]
#[ORM\JoinColumn(nullable: false)]
private ?Household $household = null;
/**
* @ORM\Id
*
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: false)]
private ?Person $person = null;
/**
* @ORM\Column(type="date_immutable")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
private $validFrom;
/**
* @ORM\Column(type="date_immutable", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true)]
private $validTo;
public function getAddress(): ?Address

View File

@@ -14,48 +14,36 @@ namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_household_position")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_position' => Position::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_position')]
class Position
{
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $allowHolder = false;
/**
* @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="float")
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
private float $ordering = 0.00;
/**
* @ORM\Column(type="boolean")
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $shareHouseHold = true;
public function getAllowHolder(): bool

View File

@@ -16,24 +16,20 @@ use Doctrine\ORM\Mapping as ORM;
/**
* MaritalStatus.
*
* @ORM\Entity
*
* @ORM\Table(name="chill_person_marital_status")
*
* @ORM\HasLifecycleCallbacks
*/
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
#[ORM\Table(name: 'chill_person_marital_status')]
class MaritalStatus
{
/**
* @ORM\Id
*
* @ORM\Column(type="string", length=7)
*/
#[ORM\Id]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 7)]
private ?string $id;
/**
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name;
public function __construct()

View File

@@ -48,39 +48,23 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Person Class.
*
* @ORM\Entity
*
* @ORM\Table(name="chill_person_person",
* indexes={
*
* @ORM\Index(
* name="person_names",
* columns={"firstName", "lastName"}
* ),
* @ORM\Index(
* name="person_birthdate",
* columns={"birthdate"}
* )
* })
* @ORM\Index(
* name="person_names",
* columns={"firstName", "lastName"}
* ),
* @ORM\Index(
* name="person_birthdate",
* columns={"birthdate"}
* )
* })
*
* @ORM\HasLifecycleCallbacks
*
*
*
* @PersonHasCenter
*
* @HouseholdMembershipSequential(
* groups={"household_memberships"}
* )
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['person' => Person::class])]
#[ORM\Entity]
#[ORM\Index(name: 'person_names', columns: ['firstName', 'lastName'])] // ,
#[ORM\Index(name: 'person_birthdate', columns: ['birthdate'])] // @ORM\HasLifecycleCallbacks
#[ORM\Table(name: 'chill_person_person')]
#[ORM\HasLifecycleCallbacks]
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable
{
final public const BOTH_GENDER = 'both';
@@ -98,16 +82,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* Accept receiving email.
*
* @ORM\Column(type="boolean", options={"default": false})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private ?bool $acceptEmail = false;
/**
* Accept short text message (aka SMS).
*
* @ORM\Column(type="boolean", options={"default": false})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
private ?bool $acceptSMS = false;
/**
@@ -115,22 +97,19 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
*
* @var Collection<AccompanyingPeriodParticipation>
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"})
*
* @ORM\OrderBy({"startDate": "DESC"})
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodParticipation::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC])]
private Collection $accompanyingPeriodParticipations;
/**
* The accompanying period requested by the Person.
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriod::class,
* mappedBy="requestorPerson")
*
* @var Collection<AccompanyingPeriod>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriod::class, mappedBy: 'requestorPerson')]
private Collection $accompanyingPeriodRequested;
/**
@@ -138,131 +117,101 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
*
* @var Collection<Address>
*
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\Address",
* cascade={"persist", "remove", "merge", "detach"})
*
* @ORM\JoinTable(name="chill_person_persons_to_addresses")
*
* @ORM\OrderBy({"validFrom": "DESC"})
*/
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\JoinTable(name: 'chill_person_persons_to_addresses')]
#[ORM\OrderBy(['validFrom' => \Doctrine\Common\Collections\Criteria::DESC])]
private Collection $addresses;
/**
* @var Collection<PersonAltName>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\PersonAltName",
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"},
* orphanRemoval=true)
*/
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\PersonAltName::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'], orphanRemoval: true)]
private Collection $altNames;
/**
* The person's birthdate.
*
* @ORM\Column(type="date", nullable=true)
*
* @Birthdate
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $birthdate = null;
/**
* @var Collection<Charge>
*
* @ORM\OneToMany(
* targetEntity=Charge::class,
* mappedBy="person"
* )
*/
#[ORM\OneToMany(targetEntity: Charge::class, mappedBy: 'person')]
private Collection $budgetCharges;
/**
* @var Collection<resource>
*
* @ORM\OneToMany(
* targetEntity=Resource::class,
* mappedBy="person"
* )
*/
#[ORM\OneToMany(targetEntity: Resource::class, mappedBy: 'person')]
private Collection $budgetResources;
/**
* @var Collection<int, Calendar>
*
* @ORM\ManyToMany(
* targetEntity="Chill\CalendarBundle\Entity\Calendar",
* mappedBy="persons"
* )
*/
#[ORM\ManyToMany(targetEntity: \Chill\CalendarBundle\Entity\Calendar::class, mappedBy: 'persons')]
private Collection $calendars;
/**
* The person's center.
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
*
* @deprecated
*/
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Center::class)]
private ?Center $center = null;
/**
* @ORM\OneToOne(targetEntity=PersonCenterCurrent::class, mappedBy="person")
*/
#[ORM\OneToOne(targetEntity: PersonCenterCurrent::class, mappedBy: 'person')]
private ?PersonCenterCurrent $centerCurrent = null;
/**
* @ORM\OneToMany(targetEntity=PersonCenterHistory::class, mappedBy="person", cascade={"persist", "remove"})
*
* @var Collection<PersonCenterHistory>
*/
#[ORM\OneToMany(targetEntity: PersonCenterHistory::class, mappedBy: 'person', cascade: ['persist', 'remove'])]
private Collection $centerHistory;
/**
* Array where customfield's data are stored.
*
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private ?array $cFData = null;
/**
* The marital status of the person.
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Civility")
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Civility::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Civility $civility = null;
/**
* Contact information for contacting the person.
*
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $contactInfo = '';
/**
* The person's country of birth.
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
*
* sf4 check: option inversedBy="birthsIn" return error mapping !!
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Country::class)] // sf4 check: option inversedBy="birthsIn" return error mapping !!
#[ORM\JoinColumn(nullable: true)]
private ?Country $countryOfBirth = null;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true)]
private ?User $createdBy = null;
/**
@@ -279,214 +228,177 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The current person address.
*
* This is computed through database and is optimized on database side.
*
* @ORM\OneToOne(targetEntity=PersonCurrentAddress::class, mappedBy="person")
*/
#[ORM\OneToOne(targetEntity: PersonCurrentAddress::class, mappedBy: 'person')]
private ?PersonCurrentAddress $currentPersonAddress = null;
/**
* The person's deathdate.
*
* @ORM\Column(type="date_immutable", nullable=true)
*/
#[Assert\Date]
#[Assert\GreaterThanOrEqual(propertyPath: 'birthdate')]
#[Assert\LessThanOrEqual('today')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $deathdate = null;
/**
* The person's email.
*
* @ORM\Column(type="text", nullable=true)
*/
#[Assert\Email]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $email = '';
/**
* The person's first name.
*
* @ORM\Column(type="string", length=255)
*/
#[Assert\NotBlank(message: 'The firstname cannot be empty')]
#[Assert\Length(max: 255)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $firstName = '';
/**
* fullname canonical. Read-only field, which is calculated by
* the database.
*
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $fullnameCanonical = '';
/**
* The person's gender.
*
* @ORM\Column(type="string", length=9, nullable=true)
*/
#[Assert\NotNull(message: 'The gender must be set')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 9, nullable: true)]
private ?string $gender = null;
/**
* Comment on gender.
*
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="genderComment_")
*/
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'genderComment_')]
private CommentEmbeddable $genderComment;
/**
* Read-only field, computed by the database.
*
* @var Collection<PersonHouseholdAddress>
*
* @ORM\OneToMany(
* targetEntity=PersonHouseholdAddress::class,
* mappedBy="person"
* )
*/
#[ORM\OneToMany(targetEntity: PersonHouseholdAddress::class, mappedBy: 'person')]
private Collection $householdAddresses;
/**
* @ORM\OneToMany(
* targetEntity=HouseholdMember::class,
* mappedBy="person"
* )
*
* @var Collection<HouseholdMember>
*/
#[ORM\OneToMany(targetEntity: HouseholdMember::class, mappedBy: 'person')]
private Collection $householdParticipations;
/**
* The person's id.
*
* @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;
/**
* The person's last name.
*
* @ORM\Column(type="string", length=255)
*/
#[Assert\NotBlank(message: 'The lastname cannot be empty')]
#[Assert\Length(max: 255)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $lastName = '';
/**
* The marital status of the person.
*
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\MaritalStatus")
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\MaritalStatus::class)]
#[ORM\JoinColumn(nullable: true)]
private ?MaritalStatus $maritalStatus = null;
/**
* Comment on marital status.
*
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="maritalStatusComment_")
*/
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'maritalStatusComment_')]
private CommentEmbeddable $maritalStatusComment;
/**
* The date of the last marital status change of the person.
*
* @ORM\Column(type="date", nullable=true)
*/
#[Assert\Date]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $maritalStatusDate = null;
/**
* A remark over the person.
*
* @ORM\Column(type="text")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $memo = '';
/**
* The person's mobile phone number.
*
* @PhonenumberConstraint(type="mobile")
*
* @ORM\Column(type="phone_number", nullable=true)
*/
#[ORM\Column(type: 'phone_number', nullable: true)]
private ?PhoneNumber $mobilenumber = null;
/**
* The person's nationality.
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
*
* sf4 check: option inversedBy="nationals" return error mapping !!
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\Country::class)] // sf4 check: option inversedBy="nationals" return error mapping !!
#[ORM\JoinColumn(nullable: true)]
private ?Country $nationality = null;
/**
* Number of children.
*
* @ORM\Column(type="integer", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)]
private ?int $numberOfChildren = null;
/**
* @var Collection<PersonPhone>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\PersonPhone",
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"},
* orphanRemoval=true
* )
*/
#[Assert\Valid(traverse: true)]
#[ORM\OneToMany(targetEntity: \Chill\PersonBundle\Entity\PersonPhone::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'], orphanRemoval: true)]
private Collection $otherPhoneNumbers;
/**
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriod::class,
* mappedBy="personLocation"
* )
*
* @var Collection<AccompanyingPeriod>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriod::class, mappedBy: 'personLocation')]
private Collection $periodLocatedOn;
/**
* The person's phonenumber.
*
* @ORM\Column(type="phone_number", nullable=true)
*
* @PhonenumberConstraint(
* type="landline",
* )
*/
#[ORM\Column(type: 'phone_number', nullable: true)]
private ?PhoneNumber $phonenumber = null;
/**
* The person's place of birth.
*
* @ORM\Column(type="string", length=255, name="place_of_birth")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, name: 'place_of_birth')]
private string $placeOfBirth = '';
/**
* @deprecated
*
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $proxyAccompanyingPeriodOpenState = false; // TO-DELETE ?
/**
* @ORM\OneToMany(targetEntity=PersonResource::class, mappedBy="personOwner")
*
* @var Collection<PersonResource>
*/
#[ORM\OneToMany(targetEntity: PersonResource::class, mappedBy: 'personOwner')]
private Collection $resources;
/**
@@ -494,26 +406,16 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
*
* @var Collection<int, Language>
*
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\Language")
*
* @ORM\JoinTable(
* name="persons_spoken_languages",
* joinColumns={@ORM\JoinColumn(name="person_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="language_id", referencedColumnName="id")}
* )
*/
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\Language::class)]
#[ORM\JoinTable(name: 'persons_spoken_languages', joinColumns: [new ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id')], inverseJoinColumns: [new ORM\JoinColumn(name: 'language_id', referencedColumnName: 'id')])]
private Collection $spokenLanguages;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeInterface $updatedAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $updatedBy = null;
/**

View File

@@ -21,39 +21,29 @@ use Doctrine\ORM\Mapping as ORM;
* The process of selecting the current center is done on database side,
* using a SQL view.
*
* @ORM\Entity(readOnly=true)
*
* @ORM\Table(name="view_chill_person_person_center_history_current")
*
* @psalm-internal Chill\PersonBundle\Entity
*/
#[ORM\Entity(readOnly: true)]
#[ORM\Table(name: 'view_chill_person_person_center_history_current')]
class PersonCenterCurrent
{
/**
* @ORM\ManyToOne(targetEntity=Center::class)
*/
#[ORM\ManyToOne(targetEntity: Center::class)]
private Center $center;
/**
* @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\Column(type="integer")
*/
#[ORM\Id]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\OneToOne(targetEntity=Person::class, inversedBy="centerCurrent")
*/
#[ORM\OneToOne(targetEntity: Person::class, inversedBy: 'centerCurrent')]
private Person $person;
/**
* @ORM\Column(type="date_immutable", nullable=false)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
private \DateTimeImmutable $startDate;
/**

View File

@@ -22,42 +22,31 @@ use Doctrine\ORM\Mapping as ORM;
/**
* Associate a Person with a Center. The association may change on date intervals.
*
* @ORM\Entity
*
* @ORM\Table(name="chill_person_person_center_history")
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_person_center_history')]
class PersonCenterHistory 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;
public function __construct(
/**
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="centerHistory")
*/
#[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'centerHistory')]
private ?Person $person = null,
/**
* @ORM\ManyToOne(targetEntity=Center::class)
*/
#[ORM\ManyToOne(targetEntity: Center::class)]
private ?Center $center = null,
/**
* @ORM\Column(type="date_immutable", nullable=false)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $startDate = null
) {}

View File

@@ -24,34 +24,25 @@ use Doctrine\ORM\Mapping as ORM;
* The validFrom and validTo properties are the intersection of
* household membership and address validity. See @see{PersonHouseholdAddress}
*
* @ORM\Entity(readOnly=true)
*
* @ORM\Table("view_chill_person_current_address")
*/
#[ORM\Entity(readOnly: true)]
#[ORM\Table('view_chill_person_current_address')]
class PersonCurrentAddress
{
/**
* @ORM\OneToOne(targetEntity=Address::class)
*/
#[ORM\OneToOne(targetEntity: Address::class)]
protected Address $address;
/**
* @ORM\Id
*
* @ORM\OneToOne(targetEntity=Person::class, inversedBy="currentPersonAddress")
*
* @ORM\JoinColumn(name="person_id", referencedColumnName="id")
*/
#[ORM\Id]
#[ORM\OneToOne(targetEntity: Person::class, inversedBy: 'currentPersonAddress')]
#[ORM\JoinColumn(name: 'person_id', referencedColumnName: 'id')]
protected Person $person;
/**
* @ORM\Column(name="valid_from", type="date_immutable")
*/
#[ORM\Column(name: 'valid_from', type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
protected \DateTimeImmutable $validFrom;
/**
* @ORM\Column(name="valid_to", type="date_immutable")
*/
#[ORM\Column(name: 'valid_to', type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE)]
protected ?\DateTimeImmutable $validTo = null;
public function getAddress(): Address

View File

@@ -24,74 +24,61 @@ use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_resource")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['personResource' => PersonResource::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_resource')]
class PersonResource implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'comment_')]
private CommentEmbeddable $comment;
/**
* @ORM\Column(type="text", nullable=true)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $freeText = 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\ManyToOne(targetEntity=PersonResourceKind::class, inversedBy="personResources")
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: PersonResourceKind::class, inversedBy: 'personResources')]
#[ORM\JoinColumn(nullable: true)]
private ?PersonResourceKind $kind = null;
/**
* The person which host the owner of this resource.
*
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Person $person = null;
/**
* The person linked with this resource.
*
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="resources")
*
* @ORM\JoinColumn(nullable=false)
*/
#[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'resources')]
#[ORM\JoinColumn(nullable: false)]
private ?Person $personOwner = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class, inversedBy="personResources")
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: ThirdParty::class, inversedBy: 'personResources')]
#[ORM\JoinColumn(nullable: true)]
private ?ThirdParty $thirdParty = null;
public function __construct()

View File

@@ -14,34 +14,26 @@ namespace Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_resource_kind")
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_resource_kind')]
class PersonResourceKind
{
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $isActive = true;
/**
* @ORM\Column(type="json", length=255)
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255)]
private array $title;
public function getId(): ?int

View File

@@ -20,70 +20,53 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Context;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=ResidentialAddressRepository::class)
*
* @ORM\Table(name="chill_person_residential_address")
*/
#[ORM\Entity(repositoryClass: ResidentialAddressRepository::class)]
#[ORM\Table(name: 'chill_person_residential_address')]
class ResidentialAddress
{
/**
* @ORM\ManyToOne(targetEntity=Address::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: Address::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Address $address = null;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="residentialAddressComment_")
*/
#[ORM\Embedded(class: \Chill\MainBundle\Entity\Embeddable\CommentEmbeddable::class, columnPrefix: 'residentialAddressComment_')]
private CommentEmbeddable $comment;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=true)
*
* @Context(normalizationContext={"groups": {"minimal"}})
*/
#[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Person $hostPerson = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
#[ORM\JoinColumn(nullable: true)]
private ?ThirdParty $hostThirdParty = 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=Person::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: false)]
private Person $person;
/**
* @ORM\Column(type="datetime_immutable")
*/
#[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
private ?\DateTimeImmutable $startDate = null;
public function __construct()

View File

@@ -17,39 +17,27 @@ use Symfony\Component\Serializer\Annotation\Groups;
/**
* PersonAltName.
*
* @ORM\Table(name="chill_person_alt_name")
*
* @ORM\Entity
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_alt_name')]
class PersonAltName
{
/**
* @ORM\Column(name="id", type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
/**
* @ORM\Column(name="key", type="string", length=255)
*/
#[Groups(['write'])]
#[ORM\Column(name: 'key', type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $key = '';
/**
* @ORM\Column(name="label", type="text")
*/
#[Groups(['write'])]
#[ORM\Column(name: 'label', type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $label = '';
/**
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\Person",
* inversedBy="altNames"
* )
*/
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class, inversedBy: 'altNames')]
private ?Person $person = null;
/**

View File

@@ -18,41 +18,33 @@ use Doctrine\ORM\Mapping as ORM;
/**
* PersonNotDuplicate.
*
* @ORM\Table(name="chill_person_not_duplicate")
*
* @ORM\Entity
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_not_duplicate')]
class PersonNotDuplicate
{
/**
* @ORM\Column(type="datetime")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
private \DateTime $date;
/**
* The person's id.
*
* @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;
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
private ?Person $person1 = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class)]
private ?Person $person2 = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
private ?User $user = null;
public function __construct()

View File

@@ -18,51 +18,32 @@ use libphonenumber\PhoneNumber;
/**
* Person Phones.
*
* @ORM\Entity
*
* @ORM\Table(name="chill_person_phone",
* indexes={
*
* @ORM\Index(name="phonenumber", columns={"phonenumber"})
* })
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_phone')]
#[ORM\Index(name: 'phonenumber', columns: ['phonenumber'])]
#[ORM\Index(name: 'phonenumber', columns: ['phonenumber'])]
class PersonPhone
{
/**
* @ORM\Column(type="datetime", nullable=false)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: false)]
private \DateTime $date;
/**
* @ORM\Column(type="text", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $description = 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;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\Person",
* inversedBy="otherPhoneNumbers"
* )
*/
#[ORM\ManyToOne(targetEntity: \Chill\PersonBundle\Entity\Person::class, inversedBy: 'otherPhoneNumbers')]
private Person $person;
/**
* @ORM\Column(type="phone_number", nullable=false)
*/
#[ORM\Column(type: 'phone_number', nullable: false)]
private ?PhoneNumber $phonenumber = null;
/**
* @ORM\Column(type="text", length=40, nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, length: 40, nullable: true)]
private ?string $type = null;
public function __construct()

View File

@@ -15,44 +15,35 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_relations")
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['relation' => Relation::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_relations')]
class Relation
{
/**
* @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="boolean", nullable=true)
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
private bool $isActive = true;
/**
* @ORM\Column(type="json", nullable=true)
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: true)]
private array $reverseTitle = [];
/**
* @ORM\Column(type="json", nullable=true)
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: true)]
private array $title = [];
public function getId(): ?int

View File

@@ -24,81 +24,62 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_relationships")
*
* @DiscriminatorColumn(name="relation_id", type="integer")
*
* @RelationshipNoDuplicate
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['relationship' => Relationship::class])]
#[ORM\Entity]
#[DiscriminatorColumn(name: 'relation_id', type: 'integer')]
#[ORM\Table(name: 'chill_person_relationships')]
class Relationship implements TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\Column(type="datetime_immutable")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE)]
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $createdBy = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Assert\NotNull]
#[Serializer\Groups(['read', 'write'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: false)]
private ?Person $fromPerson = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Relation::class)
*
* @ORM\JoinColumn(nullable=false, name="relation_id", referencedColumnName="id")
*/
#[Assert\NotNull]
#[Serializer\Groups(['read', 'write'])]
#[ORM\ManyToOne(targetEntity: Relation::class)]
#[ORM\JoinColumn(nullable: false, name: 'relation_id', referencedColumnName: 'id')]
private ?Relation $relation = null;
/**
* @ORM\Column(type="boolean")
*/
#[Assert\Type(type: 'bool', message: 'This must be of type boolean')]
#[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $reverse;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=false)
*/
#[Assert\NotNull]
#[Serializer\Groups(['read', 'write'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: false)]
private ?Person $toPerson = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $updatedBy = null;
public function getCreatedAt(): ?\DateTimeImmutable

View File

@@ -17,63 +17,45 @@ 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_social_work_evaluation")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_evaluation' => Evaluation::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_social_work_evaluation')]
class Evaluation
{
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": true})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => true])]
private bool $active = true;
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATEINTERVAL, nullable: true, options: ['default' => null])]
private ?\DateInterval $delay = 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="dateinterval", nullable=true, options={"default": null})
*/
#[Serializer\Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATEINTERVAL, nullable: true, options: ['default' => null])]
private ?\DateInterval $notificationDelay = null;
/**
* @var Collection<SocialAction>
*
* @ORM\ManyToMany(
* targetEntity=SocialAction::class,
* mappedBy="evaluations"
* )
*/
#[ORM\ManyToMany(targetEntity: SocialAction::class, mappedBy: 'evaluations')]
private Collection $socialActions;
/**
* @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 $title = [];
/**
* @ORM\Column(type="text", nullable=true)
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $url = null;
public function __construct()

View File

@@ -16,51 +16,42 @@ 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_social_work_goal")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_goal' => Goal::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_social_work_goal')]
class Goal
{
/**
* @ORM\Column(type="datetime", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $desactivationDate = 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;
/**
* @var Collection<Result>
*
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="goals")
*
* @ORM\JoinTable(name="chill_person_social_work_goal_result")
*/
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'goals')]
#[ORM\JoinTable(name: 'chill_person_social_work_goal_result')]
private Collection $results;
/**
* @var Collection<SocialAction>
*
* @ORM\ManyToMany(targetEntity=SocialAction::class, mappedBy="goals")
*/
#[ORM\ManyToMany(targetEntity: SocialAction::class, mappedBy: 'goals')]
private Collection $socialActions;
/**
* @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 $title = [];
public function __construct()

View File

@@ -19,63 +19,51 @@ 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_social_work_result")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_result' => Result::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_social_work_result')]
class Result
{
/**
* @var Collection<AccompanyingPeriodWorkGoal>
*
* @ORM\ManyToMany(targetEntity=AccompanyingPeriodWorkGoal::class, mappedBy="results")
*/
#[ORM\ManyToMany(targetEntity: AccompanyingPeriodWorkGoal::class, mappedBy: 'results')]
private Collection $accompanyingPeriodWorkGoals;
/**
* @var Collection<AccompanyingPeriodWork>
*
* @ORM\ManyToMany(targetEntity=AccompanyingPeriodWork::class, mappedBy="results")
*/
#[ORM\ManyToMany(targetEntity: AccompanyingPeriodWork::class, mappedBy: 'results')]
private Collection $accompanyingPeriodWorks;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTime $desactivationDate = null;
/**
* @var Collection<Goal>
*
* @ORM\ManyToMany(targetEntity=Goal::class, mappedBy="results")
*/
#[ORM\ManyToMany(targetEntity: Goal::class, mappedBy: 'results')]
private Collection $goals;
/**
* @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;
/**
* @var Collection<SocialAction>
*
* @ORM\ManyToMany(targetEntity=SocialAction::class, mappedBy="results")
*/
#[ORM\ManyToMany(targetEntity: SocialAction::class, mappedBy: 'results')]
private Collection $socialActions;
/**
* @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 $title = [];
public function __construct()

View File

@@ -18,85 +18,67 @@ use Doctrine\Common\Collections\ReadableCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_social_action")
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['social_work_social_action' => SocialAction::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_social_action')]
class SocialAction
{
/**
* @var Collection<SocialAction>
*
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="parent")
*/
#[ORM\OneToMany(targetEntity: SocialAction::class, mappedBy: 'parent')]
private Collection $children;
/**
* @ORM\Column(type="dateinterval", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATEINTERVAL, nullable: true)]
private ?\DateInterval $defaultNotificationDelay = null;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $desactivationDate = null;
/**
* @var Collection<Evaluation>
*
* @ORM\ManyToMany(targetEntity=Evaluation::class, inversedBy="socialActions")
*
* @ORM\JoinTable(name="chill_person_social_work_evaluation_action")
*/
#[ORM\ManyToMany(targetEntity: Evaluation::class, inversedBy: 'socialActions')]
#[ORM\JoinTable(name: 'chill_person_social_work_evaluation_action')]
private Collection $evaluations;
/**
* @var Collection<Goal>
*
* @ORM\ManyToMany(targetEntity=Goal::class, inversedBy="socialActions")
*
* @ORM\JoinTable(name="chill_person_social_action_goal")
*/
#[ORM\ManyToMany(targetEntity: Goal::class, inversedBy: 'socialActions')]
#[ORM\JoinTable(name: 'chill_person_social_action_goal')]
private Collection $goals;
/**
* @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=SocialIssue::class, inversedBy="socialActions")
*/
#[ORM\ManyToOne(targetEntity: SocialIssue::class, inversedBy: 'socialActions')]
private ?SocialIssue $issue = null;
/**
* @ORM\Column(type="float", name="ordering", options={"default": 0.0})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', options: ['default' => '0.0'])]
private float $ordering = 0.0;
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class, inversedBy="children")
*/
#[ORM\ManyToOne(targetEntity: SocialAction::class, inversedBy: 'children')]
private ?SocialAction $parent = null;
/**
* @var Collection<Result>
*
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="socialActions")
*
* @ORM\JoinTable(name="chill_person_social_action_result")
*/
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'socialActions')]
#[ORM\JoinTable(name: 'chill_person_social_action_result')]
private Collection $results;
/**
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $title = [];
public function __construct()

View File

@@ -17,56 +17,41 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_social_issue")
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['social_issue' => SocialIssue::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_social_issue')]
class SocialIssue
{
/**
* @var Collection<SocialIssue>
*
* @ORM\OneToMany(targetEntity=SocialIssue::class, mappedBy="parent")
*/
#[ORM\OneToMany(targetEntity: SocialIssue::class, mappedBy: 'parent')]
private Collection $children;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $desactivationDate = 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\Column(type="float", name="ordering", options={"default": 0.0})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', options: ['default' => '0.0'])]
private float $ordering = 0.0;
/**
* @ORM\ManyToOne(targetEntity=SocialIssue::class, inversedBy="children")
*/
#[ORM\ManyToOne(targetEntity: SocialIssue::class, inversedBy: 'children')]
private ?SocialIssue $parent = null;
/**
* @var Collection<SocialAction>
*
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="issue")
*/
#[ORM\OneToMany(targetEntity: SocialAction::class, mappedBy: 'issue')]
private Collection $socialActions;
/**
* @ORM\Column(type="json")
*/
#[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $title = [];
public function __construct()

View File

@@ -27,7 +27,7 @@ class ByStepAggregatorTest extends AbstractAggregatorTest
public function getAggregator()
{
$translator = new class () implements TranslatorInterface {
public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null)
public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null)
{
return $id;
}

View File

@@ -28,7 +28,7 @@ class ByStepFilterTest extends AbstractFilterTest
public function getFilter()
{
$translator = new class () implements TranslatorInterface {
public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null)
public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null)
{
return $id;
}