<?php
namespace App\Entity;
use App\Repository\ClientRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[ORM\Entity(repositoryClass: ClientRepository::class)]
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
class Client
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $email = null;
#[ORM\Column(length: 255 , nullable: true)]
private ?string $nom = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $prenom = null;
#[ORM\Column(length: 255, unique: true)]
private ?string $raisonsocial = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $adresse = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tel = null;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Intervention::class, cascade: ["remove"])]
private Collection $intervention;
#[ORM\ManyToOne(inversedBy: 'clients', cascade: ["remove"])]
#[ORM\JoinColumn(nullable: true)]
private ?Fraisdeliv $region = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $photo = null;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Devis::class, cascade: ["remove"])]
private Collection $devis;
#[ORM\Column(length: 255, nullable: true)]
private ?string $faxclient = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mfclient = null;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Gestionmachines::class, cascade: ["remove"])]
private Collection $gestionmachines;
#[ORM\Column(nullable: true)]
private ?bool $exoneres = null;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Importdirect::class, cascade: ["remove"])]
private Collection $importdirects;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Commissions::class, cascade: ["remove"])]
private Collection $commissions;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Historiquedemandedevis::class, cascade: ["remove"])]
private Collection $historiquedemandedevis;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Historiqueintervention::class, cascade: ["remove"])]
private Collection $historiqueinterventions;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Bondesortie::class)]
private Collection $bondesorties;
public function __toString(): string
{
return $this->raisonsocial;
}
public function __construct()
{
$this->intervention = new ArrayCollection();
$this->devis = new ArrayCollection();
$this->gestionmachines = new ArrayCollection();
$this->importdirects = new ArrayCollection();
$this->commissions = new ArrayCollection();
$this->historiquedemandedevis = new ArrayCollection();
$this->historiqueinterventions = new ArrayCollection();
$this->bondesorties = new ArrayCollection();
}
public function getNom(): ?string
{
return $this->nom;
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): void
{
$this->email = $email;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getPrenom(): ?string
{
return $this->prenom;
}
public function setPrenom(string $prenom): self
{
$this->prenom = $prenom;
return $this;
}
public function getRaisonsocial(): ?string
{
return $this->raisonsocial;
}
public function setRaisonsocial(string $raisonsocial): self
{
$this->raisonsocial = $raisonsocial;
return $this;
}
public function getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(string $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getTel(): ?string
{
return $this->tel;
}
public function setTel(string $tel): self
{
$this->tel = $tel;
return $this;
}
/**
* @return Collection<int, Intervention>
*/
public function getIntervention(): Collection
{
return $this->intervention;
}
public function addIntervention(Intervention $intervention): self
{
if (!$this->intervention->contains($intervention)) {
$this->intervention->add($intervention);
$intervention->setClient($this);
}
return $this;
}
public function removeIntervention(Intervention $intervention): self
{
if ($this->intervention->removeElement($intervention)) {
// set the owning side to null (unless already changed)
if ($intervention->getClient() === $this) {
$intervention->setClient(null);
}
}
return $this;
}
public function getRegion(): ?Fraisdeliv
{
return $this->region;
}
public function setRegion(?Fraisdeliv $region): self
{
$this->region = $region;
return $this;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(string $photo): self
{
$this->photo = $photo;
return $this;
}
/**
* @return Collection<int, Devis>
*/
public function getDevis(): Collection
{
return $this->devis;
}
public function addDevi(Devis $devi): self
{
if (!$this->devis->contains($devi)) {
$this->devis->add($devi);
$devi->setClient($this);
}
return $this;
}
public function removeDevi(Devis $devi): self
{
if ($this->devis->removeElement($devi)) {
// set the owning side to null (unless already changed)
if ($devi->getClient() === $this) {
$devi->setClient(null);
}
}
return $this;
}
public function getFaxclient(): ?string
{
return $this->faxclient;
}
public function setFaxclient(?string $faxclient): self
{
$this->faxclient = $faxclient;
return $this;
}
public function getMfclient(): ?string
{
return $this->mfclient;
}
public function setMfclient(?string $mfclient): self
{
$this->mfclient = $mfclient;
return $this;
}
/**
* @return Collection<int, Gestionmachines>
*/
public function getGestionmachines(): Collection
{
return $this->gestionmachines;
}
public function addGestionmachine(Gestionmachines $gestionmachine): self
{
if (!$this->gestionmachines->contains($gestionmachine)) {
$this->gestionmachines->add($gestionmachine);
$gestionmachine->setClient($this);
}
return $this;
}
public function removeGestionmachine(Gestionmachines $gestionmachine): self
{
if ($this->gestionmachines->removeElement($gestionmachine)) {
// set the owning side to null (unless already changed)
if ($gestionmachine->getClient() === $this) {
$gestionmachine->setClient(null);
}
}
return $this;
}
public function getExoneres(): ?bool
{
return $this->exoneres;
}
public function isExoneres(): ?bool
{
return $this->exoneres;
}
public function setExoneres(?bool $exoneres): self
{
$this->exoneres = $exoneres;
return $this;
}
/**
* @return Collection<int, Importdirect>
*/
public function getImportdirects(): Collection
{
return $this->importdirects;
}
public function addImportdirect(Importdirect $importdirect): static
{
if (!$this->importdirects->contains($importdirect)) {
$this->importdirects->add($importdirect);
$importdirect->setClient($this);
}
return $this;
}
public function removeImportdirect(Importdirect $importdirect): static
{
if ($this->importdirects->removeElement($importdirect)) {
// set the owning side to null (unless already changed)
if ($importdirect->getClient() === $this) {
$importdirect->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, Commissions>
*/
public function getCommissions(): Collection
{
return $this->commissions;
}
public function addCommission(Commissions $commission): static
{
if (!$this->commissions->contains($commission)) {
$this->commissions->add($commission);
$commission->setClient($this);
}
return $this;
}
public function removeCommission(Commissions $commission): static
{
if ($this->commissions->removeElement($commission)) {
// set the owning side to null (unless already changed)
if ($commission->getClient() === $this) {
$commission->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, Historiquedemandedevis>
*/
public function getHistoriquedemandedevis(): Collection
{
return $this->historiquedemandedevis;
}
public function addHistoriquedemandedevi(Historiquedemandedevis $historiquedemandedevi): static
{
if (!$this->historiquedemandedevis->contains($historiquedemandedevi)) {
$this->historiquedemandedevis->add($historiquedemandedevi);
$historiquedemandedevi->setClient($this);
}
return $this;
}
public function removeHistoriquedemandedevi(Historiquedemandedevis $historiquedemandedevi): static
{
if ($this->historiquedemandedevis->removeElement($historiquedemandedevi)) {
// set the owning side to null (unless already changed)
if ($historiquedemandedevi->getClient() === $this) {
$historiquedemandedevi->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, Historiqueintervention>
*/
public function getHistoriqueinterventions(): Collection
{
return $this->historiqueinterventions;
}
public function addHistoriqueintervention(Historiqueintervention $historiqueintervention): static
{
if (!$this->historiqueinterventions->contains($historiqueintervention)) {
$this->historiqueinterventions->add($historiqueintervention);
$historiqueintervention->setClient($this);
}
return $this;
}
public function removeHistoriqueintervention(Historiqueintervention $historiqueintervention): static
{
if ($this->historiqueinterventions->removeElement($historiqueintervention)) {
// set the owning side to null (unless already changed)
if ($historiqueintervention->getClient() === $this) {
$historiqueintervention->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, Bondesortie>
*/
public function getBondesorties(): Collection
{
return $this->bondesorties;
}
public function addBondesorty(Bondesortie $bondesorty): self
{
if (!$this->bondesorties->contains($bondesorty)) {
$this->bondesorties->add($bondesorty);
$bondesorty->setClient($this);
}
return $this;
}
public function removeBondesorty(Bondesortie $bondesorty): self
{
if ($this->bondesorties->removeElement($bondesorty)) {
// set the owning side to null (unless already changed)
if ($bondesorty->getClient() === $this) {
$bondesorty->setClient(null);
}
}
return $this;
}
}