mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 10:03:49 +00:00
Apply rector rules: add annotation for doctrine mapping
This commit is contained in:
@@ -18,7 +18,6 @@ use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Civility;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ReadableCollection;
|
||||
@@ -73,8 +72,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
* noticing a difference.
|
||||
*/
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: "chill_3party.third_party")]
|
||||
#[DiscriminatorMap(typeProperty: "type", mapping: ["thirdparty" => ThirdParty::class])]
|
||||
#[ORM\Table(name: 'chill_3party.third_party')]
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['thirdparty' => ThirdParty::class])]
|
||||
class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Stringable
|
||||
{
|
||||
final public const KIND_CHILD = 'child';
|
||||
@@ -97,7 +96,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
#[ORM\Column(name: 'active', type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['defaut' => true])]
|
||||
private bool $active = true;
|
||||
|
||||
|
||||
#[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])]
|
||||
#[ORM\ManyToOne(targetEntity: Address::class, cascade: ['persist', 'remove'])]
|
||||
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
|
||||
@@ -114,19 +112,15 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
|
||||
/**
|
||||
* @var Collection<ThirdPartyCategory>
|
||||
*
|
||||
*
|
||||
*/
|
||||
#[Groups(['docgen:read', 'docgen:read:3party:parent'])]
|
||||
#[ORM\ManyToMany(targetEntity: \Chill\ThirdPartyBundle\Entity\ThirdPartyCategory::class)]
|
||||
#[ORM\ManyToMany(targetEntity: ThirdPartyCategory::class)]
|
||||
#[ORM\JoinTable(name: 'chill_3party.thirdparty_category', joinColumns: [new ORM\JoinColumn(name: 'thirdparty_id', referencedColumnName: 'id')], inverseJoinColumns: [new ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')])]
|
||||
#[Context(normalizationContext: ['groups' => 'docgen:read'], groups: ['docgen:read:3party:parent'])]
|
||||
private Collection $categories;
|
||||
|
||||
/**
|
||||
* @var Collection<Center>
|
||||
*
|
||||
*
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Center::class)]
|
||||
#[ORM\JoinTable(name: 'chill_3party.party_center')]
|
||||
@@ -135,14 +129,13 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
/**
|
||||
* Contact Persons: One Institutional ThirdParty has Many Contact Persons.
|
||||
*
|
||||
*
|
||||
* @var Collection<ThirdParty>
|
||||
*/
|
||||
#[Assert\Valid(traverse: true)]
|
||||
#[ORM\OneToMany(targetEntity: ThirdParty::class, mappedBy: 'parent', cascade: ['persist'], orphanRemoval: true)]
|
||||
private Collection $children;
|
||||
|
||||
#[Context(normalizationContext: ["groups" => "docgen:read"], groups: ['docgen:read:3party:parent'])]
|
||||
#[Context(normalizationContext: ['groups' => 'docgen:read'], groups: ['docgen:read:3party:parent'])]
|
||||
#[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])]
|
||||
#[ORM\ManyToOne(targetEntity: Civility::class)] // ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
|
||||
private ?Civility $civility = null;
|
||||
@@ -158,8 +151,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
#[ORM\Column(name: 'created_at', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
|
||||
private \DateTimeImmutable $createdAt;
|
||||
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(name: 'created_by', referencedColumnName: 'id')]
|
||||
private ?User $createdBy = null;
|
||||
|
||||
@@ -172,7 +164,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
#[ORM\Column(name: 'firstname', type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])]
|
||||
private ?string $firstname = '';
|
||||
|
||||
|
||||
#[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])]
|
||||
#[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Id]
|
||||
@@ -200,8 +191,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
|
||||
/**
|
||||
* Institutional ThirdParty: Many Contact Persons have One Institutional ThirdParty.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
#[ORM\ManyToOne(targetEntity: ThirdParty::class, inversedBy: 'children')]
|
||||
@@ -211,7 +200,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
|
||||
/**
|
||||
* [fr] Qualité.
|
||||
*
|
||||
*/
|
||||
#[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])]
|
||||
#[ORM\Column(name: 'profession', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)]
|
||||
@@ -231,8 +219,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
#[ORM\Column(name: 'updated_at', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)]
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: \Chill\MainBundle\Entity\User::class)]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(name: 'updated_by', referencedColumnName: 'id')]
|
||||
private ?User $updatedBy = null;
|
||||
|
||||
|
@@ -15,7 +15,6 @@ use Chill\ThirdPartyBundle\Repository\ThirdPartyCategoryRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
|
||||
#[ORM\Entity(repositoryClass: ThirdPartyCategoryRepository::class)]
|
||||
#[ORM\Table(name: 'chill_3party.party_category')]
|
||||
class ThirdPartyCategory
|
||||
@@ -23,7 +22,6 @@ class ThirdPartyCategory
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
private bool $active = true;
|
||||
|
||||
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
|
@@ -15,7 +15,6 @@ use Chill\ThirdPartyBundle\Repository\ThirdPartyProfessionRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['third_party_profession' => ThirdPartyProfession::class])]
|
||||
#[ORM\Entity(repositoryClass: ThirdPartyProfessionRepository::class)]
|
||||
#[ORM\Table(name: 'chill_3party.party_profession')]
|
||||
@@ -25,7 +24,6 @@ class ThirdPartyProfession
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
private bool $active = true;
|
||||
|
||||
|
||||
#[Serializer\Groups(['docgen:read', 'read', 'write'])]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
|
Reference in New Issue
Block a user