Apply rector rules: add annotation for doctrine mapping

This commit is contained in:
2024-04-05 13:11:42 +02:00
parent a3f775a69b
commit 0ff4593863
118 changed files with 143 additions and 658 deletions

View File

@@ -26,8 +26,6 @@ use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
*
*
* @MaxHolder(groups={"household_memberships"})
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household' => Household::class])]
@@ -39,14 +37,11 @@ class Household
* Addresses.
*
* @var Collection<Address>
*
*
*
*/
#[Serializer\Groups(['write'])]
#[ORM\ManyToMany(targetEntity: \Chill\MainBundle\Entity\Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\ManyToMany(targetEntity: 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'])]
#[ORM\OrderBy(['validFrom' => Criteria::DESC, 'id' => 'DESC'])]
private Collection $addresses;
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_members_')]
@@ -54,15 +49,12 @@ class Household
/**
* @var Collection&Selectable<int, HouseholdComposition>
*
*
*/
#[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])]
#[ORM\OrderBy(['startDate' => Criteria::DESC])]
private Collection&Selectable $compositions;
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]

View File

@@ -20,7 +20,6 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_composition')]
@@ -38,18 +37,15 @@ class HouseholdComposition implements TrackCreationInterface, TrackUpdateInterfa
#[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)]
private ?Household $household = null;
#[Serializer\Groups(['docgen:read'])]
#[ORM\ManyToOne(targetEntity: HouseholdCompositionType::class)]
#[ORM\JoinColumn(nullable: false)]
private ?HouseholdCompositionType $householdCompositionType = null;
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]

View File

@@ -14,7 +14,6 @@ namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_composition_type' => HouseholdCompositionType::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_composition_type')]
@@ -23,7 +22,6 @@ class HouseholdCompositionType
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $active = true;
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]

View File

@@ -16,7 +16,6 @@ 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')]
class HouseholdMember
@@ -39,7 +38,6 @@ class HouseholdMember
#[ORM\ManyToOne(targetEntity: Household::class)]
private ?Household $household = null;
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]

View File

@@ -38,26 +38,21 @@ use Doctrine\ORM\Mapping as ORM;
* 1. 1st entity: from 2021-01-01 to 2021-06-01, household W, address Q;
* 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')]
class PersonHouseholdAddress
{
#[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)]
private ?Household $household = null;
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: false)]

View File

@@ -14,7 +14,6 @@ namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['household_position' => Position::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_household_position')]
@@ -24,7 +23,6 @@ class Position
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $allowHolder = false;
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]