<?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(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $societe;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $contactNom;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $contactPrenom;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $telephone;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $email;
#[ORM\Column(type: 'text', nullable: true)]
private $adresse;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $codePostal;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $ville;
#[ORM\Column(type: 'text', nullable: true)]
private $remarques;
#[ORM\OneToMany(targetEntity: Affaire::class, mappedBy: 'client', cascade: ['persist'])]
private $affaires;
#[ORM\ManyToOne(targetEntity: TypeClient::class, inversedBy: 'clients')]
private $type;
public function __construct()
{
$this->affaires = new ArrayCollection();
}
public function __toString()
{
$societe=$this->getSociete();
if(!$societe){$societe="non renseigné";}
return $societe;
}
public function getId(): ?int
{
return $this->id;
}
public function getSociete(): ?string
{
return $this->societe;
}
public function setSociete(?string $societe): self
{
$this->societe = $societe;
return $this;
}
public function getContactNom(): ?string
{
return $this->contactNom;
}
public function setContactNom(?string $contactNom): self
{
$this->contactNom = $contactNom;
return $this;
}
public function getContactPrenom(): ?string
{
return $this->contactPrenom;
}
public function setContactPrenom(?string $contactPrenom): self
{
$this->contactPrenom = $contactPrenom;
return $this;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(?string $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getCodePostal(): ?string
{
return $this->codePostal;
}
public function setCodePostal(?string $codePostal): self
{
$this->codePostal = $codePostal;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getRemarques(): ?string
{
return $this->remarques;
}
public function setRemarques(?string $remarques): self
{
$this->remarques = $remarques;
return $this;
}
/**
* @return Collection|Affaire[]
*/
public function getAffaires(): Collection
{
return $this->affaires;
}
public function addAffaire(Affaire $affaire): self
{
if (!$this->affaires->contains($affaire)) {
$this->affaires[] = $affaire;
$affaire->setClient($this);
}
return $this;
}
public function removeAffaire(Affaire $affaire): self
{
if ($this->affaires->removeElement($affaire)) {
// set the owning side to null (unless already changed)
if ($affaire->getClient() === $this) {
$affaire->setClient(null);
}
}
return $this;
}
public function getType(): ?TypeClient
{
return $this->type;
}
public function setType(?TypeClient $type): self
{
$this->type = $type;
return $this;
}
}