mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
Apply rector rules: add annotation for doctrine mapping
This commit is contained in:
@@ -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;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user