['client_contact:read']], ), new Post( uriTemplate: '/clients/{clientId}/contacts', uriVariables: [ 'clientId' => new Link(fromClass: Client::class, toProperty: 'client'), ], security: "is_granted('commercial.clients.manage')", normalizationContext: ['groups' => ['client_contact:read']], denormalizationContext: ['groups' => ['client_contact:write']], processor: ClientContactProcessor::class, ), new Patch( security: "is_granted('commercial.clients.manage')", normalizationContext: ['groups' => ['client_contact:read']], denormalizationContext: ['groups' => ['client_contact:write']], processor: ClientContactProcessor::class, ), new Delete( security: "is_granted('commercial.clients.manage')", processor: ClientContactProcessor::class, ), ], )] #[ORM\Entity(repositoryClass: DoctrineClientContactRepository::class)] #[ORM\Table(name: 'client_contact')] #[ORM\Index(name: 'idx_client_contact_client', columns: ['client_id'])] #[Auditable] class ClientContact implements TimestampableInterface, BlamableInterface { use TimestampableBlamableTrait; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['client_contact:read'])] private ?int $id = null; #[ORM\ManyToOne(targetEntity: Client::class, inversedBy: 'contacts')] #[ORM\JoinColumn(name: 'client_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')] private ?Client $client = null; // RG-1.05 : firstName OU lastName obligatoire (CHECK BDD + Processor). Les // deux restent nullable au niveau ORM. #[ORM\Column(length: 120, nullable: true)] #[Assert\Length(max: 120, normalizer: 'trim')] #[Groups(['client_contact:read', 'client_contact:write'])] private ?string $firstName = null; #[ORM\Column(length: 120, nullable: true)] #[Assert\Length(max: 120, normalizer: 'trim')] #[Groups(['client_contact:read', 'client_contact:write'])] private ?string $lastName = null; #[ORM\Column(length: 120, nullable: true)] #[Assert\Length(max: 120, normalizer: 'trim')] #[Groups(['client_contact:read', 'client_contact:write'])] private ?string $jobTitle = null; #[ORM\Column(length: 20, nullable: true)] #[Groups(['client_contact:read', 'client_contact:write'])] private ?string $phonePrimary = null; #[ORM\Column(length: 20, nullable: true)] #[Groups(['client_contact:read', 'client_contact:write'])] private ?string $phoneSecondary = null; #[ORM\Column(length: 180, nullable: true)] #[Assert\Email] #[Groups(['client_contact:read', 'client_contact:write'])] private ?string $email = null; #[ORM\Column(options: ['default' => 0])] #[Groups(['client_contact:read', 'client_contact:write'])] private int $position = 0; public function getId(): ?int { return $this->id; } public function getClient(): ?Client { return $this->client; } public function setClient(?Client $client): static { $this->client = $client; return $this; } public function getFirstName(): ?string { return $this->firstName; } public function setFirstName(?string $firstName): static { $this->firstName = $firstName; return $this; } public function getLastName(): ?string { return $this->lastName; } public function setLastName(?string $lastName): static { $this->lastName = $lastName; return $this; } public function getJobTitle(): ?string { return $this->jobTitle; } public function setJobTitle(?string $jobTitle): static { $this->jobTitle = $jobTitle; return $this; } public function getPhonePrimary(): ?string { return $this->phonePrimary; } public function setPhonePrimary(?string $phonePrimary): static { $this->phonePrimary = $phonePrimary; return $this; } public function getPhoneSecondary(): ?string { return $this->phoneSecondary; } public function setPhoneSecondary(?string $phoneSecondary): static { $this->phoneSecondary = $phoneSecondary; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(?string $email): static { $this->email = $email; return $this; } public function getPosition(): int { return $this->position; } public function setPosition(int $position): static { $this->position = $position; return $this; } }