← Back
Editing: AgencyPrestataire.php
<?php namespace App\Entity; use App\Repository\AgencyPrestataireRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; /** * AgencyPrestataire. */ #[ORM\Table(name: 'tl_agency_prestataire')] #[ORM\Index(columns: ['agency_id'], name: 'agency_id')] #[ORM\Index(columns: ['prestataire_id'], name: 'prestataire_id')] #[ORM\Entity(repositoryClass: AgencyPrestataireRepository::class)] #[UniqueEntity(['mailContact', 'prestataire'])] class AgencyPrestataire { #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] private ?int $id = null; #[ORM\Column(name: 'prenom_contact', type: 'string', length: 255, nullable: true)] private ?string $prenomContact = null; #[ORM\Column(name: 'nom_contact', type: 'string', length: 255, nullable: true)] private ?string $nomContact = null; #[ORM\Column(name: 'mail_contact', type: 'string', length: 255, nullable: true)] #[Assert\Email] private ?string $mailContact = null; #[ORM\Column(name: 'telephone', type: 'string', length: 255, nullable: true)] private ?string $telephone = null; #[ORM\Column(name: 'numero_contrat', type: 'string', length: 255, nullable: true)] private ?string $numeroContrat = null; #[ORM\JoinColumn(name: 'prestataire_id', referencedColumnName: 'id', onDelete: 'CASCADE')] #[ORM\ManyToOne(targetEntity: 'Prestataire', inversedBy: 'agencyPrestataires')] #[ORM\OrderBy(['sort_order' => 'ASC'])] #[Groups(['supervisor_presta'])] private ?Prestataire $prestataire = null; #[ORM\JoinColumn(onDelete: 'CASCADE')] #[ORM\ManyToOne(targetEntity: 'Agency', inversedBy: 'prestas')] private Agency $agency; #[ORM\OneToMany(mappedBy: 'prestataire', targetEntity: HistoriqueAlerte::class)] private Collection $historiqueAlertes; #[ORM\OneToMany(mappedBy: 'providerContact', targetEntity: Service::class)] private Collection $services; public function __construct() { $this->historiqueAlertes = new ArrayCollection(); $this->services = new ArrayCollection(); } public function __toString(): string { return $this->getPrenomContact().' '.$this->getNomContact(); } public function getId(): ?int { return $this->id; } public function getPrenomContact(): ?string { return $this->prenomContact; } public function setPrenomContact(?string $prenomContact): self { $this->prenomContact = $prenomContact; return $this; } public function getNomContact(): ?string { return $this->nomContact; } public function setNomContact(?string $nomContact): self { $this->nomContact = $nomContact; return $this; } public function getMailContact(): ?string { return $this->mailContact; } public function setMailContact(?string $mailContact): self { $this->mailContact = $mailContact; return $this; } public function getTelephone(): ?string { return $this->telephone; } public function setTelephone(?string $telephone): self { $this->telephone = $telephone; return $this; } public function getNumeroContrat(): ?string { return $this->numeroContrat; } public function setNumeroContrat(?string $numeroContrat): self { $this->numeroContrat = $numeroContrat; return $this; } public function getPrestataire(): ?Prestataire { return $this->prestataire; } public function setPrestataire(?Prestataire $prestataire): self { $this->prestataire = $prestataire; return $this; } public function getAgency(): Agency { return $this->agency; } public function setAgency(?Agency $agency): self { $this->agency = $agency; return $this; } public function getHistoriqueAlertes(): Collection { return $this->historiqueAlertes; } public function addHistoriqueAlerte(HistoriqueAlerte $historiqueAlerte): self { if (!$this->historiqueAlertes->contains($historiqueAlerte)) { $this->historiqueAlertes[] = $historiqueAlerte; $historiqueAlerte->setPrestataire($this); } return $this; } public function getServices(): Collection { return $this->services; } public function addService(Service $service): self { if (!$this->services->contains($service)) { $this->services[] = $service; $service->setProviderContact($this); } return $this; } public function removeService(Service $service): self { $this->services->removeElement($service); return $this; } public function removeHistoriqueAlerte(HistoriqueAlerte $historiqueAlerte): self { if ($this->historiqueAlertes->removeElement($historiqueAlerte)) { // set the owning side to null (unless already changed) if ($historiqueAlerte->getPrestataire() === $this) { $historiqueAlerte->setPrestataire(null); } } return $this; } }
Save File
Cancel