mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-07 15:25:00 +00:00
Apply rector rules: add annotation for doctrine mapping
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user