<?php
namespace App\Entity;
use App\Repository\ClientRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ClientRepository::class)]
class Client
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(length: 20, nullable: true)]
private ?string $phone = null;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Echeance::class)]
private Collection $echeances;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Vente::class)]
private Collection $ventes;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Livraison::class)]
private Collection $livraisons;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Facture::class)]
private Collection $facture;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: FactureService::class)]
private Collection $factureServices;
public function __construct()
{
$this->echeances = new ArrayCollection();
$this->ventes = new ArrayCollection();
$this->livraisons = new ArrayCollection();
$this->facture = new ArrayCollection();
$this->factureServices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): static
{
$this->nom = $nom;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): static
{
$this->phone = $phone;
return $this;
}
/**
* @return Collection<int, Echeance>
*/
public function getEcheances(): Collection
{
return $this->echeances;
}
public function addEcheance(Echeance $echeance): static
{
if (!$this->echeances->contains($echeance)) {
$this->echeances->add($echeance);
$echeance->setClient($this);
}
return $this;
}
public function removeEcheance(Echeance $echeance): static
{
if ($this->echeances->removeElement($echeance)) {
// set the owning side to null (unless already changed)
if ($echeance->getClient() === $this) {
$echeance->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, Vente>
*/
public function getVentes(): Collection
{
return $this->ventes;
}
public function addVente(Vente $vente): static
{
if (!$this->ventes->contains($vente)) {
$this->ventes->add($vente);
$vente->setClient($this);
}
return $this;
}
public function removeVente(Vente $vente): static
{
if ($this->ventes->removeElement($vente)) {
// set the owning side to null (unless already changed)
if ($vente->getClient() === $this) {
$vente->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, Livraison>
*/
public function getLivraisons(): Collection
{
return $this->livraisons;
}
public function addLivraison(Livraison $livraison): static
{
if (!$this->livraisons->contains($livraison)) {
$this->livraisons->add($livraison);
$livraison->setClient($this);
}
return $this;
}
public function removeLivraison(Livraison $livraison): static
{
if ($this->livraisons->removeElement($livraison)) {
// set the owning side to null (unless already changed)
if ($livraison->getClient() === $this) {
$livraison->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, Facture>
*/
public function getFacture(): Collection
{
return $this->facture;
}
public function addFacture(Facture $facture): static
{
if (!$this->facture->contains($facture)) {
$this->facture->add($facture);
$facture->setClient($this);
}
return $this;
}
public function removeFacture(Facture $facture): static
{
if ($this->facture->removeElement($facture)) {
// set the owning side to null (unless already changed)
if ($facture->getClient() === $this) {
$facture->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, FactureService>
*/
public function getFactureServices(): Collection
{
return $this->factureServices;
}
public function addFactureService(FactureService $factureService): static
{
if (!$this->factureServices->contains($factureService)) {
$this->factureServices->add($factureService);
$factureService->setClient($this);
}
return $this;
}
public function removeFactureService(FactureService $factureService): static
{
if ($this->factureServices->removeElement($factureService)) {
// set the owning side to null (unless already changed)
if ($factureService->getClient() === $this) {
$factureService->setClient(null);
}
}
return $this;
}
}