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

@@ -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()