<?php
namespace App\Entity;
use App\Repository\FournisseurRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[ORM\Entity(repositoryClass: FournisseurRepository::class)]
#[UniqueEntity(fields: ['email'], message: 'Il existe déjà un compte avec cet email')]
class Fournisseur
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, unique: true)]
private ?string $email = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(length: 255)]
private ?string $prenom = null;
#[ORM\Column(length: 255)]
private ?string $tel = null;
#[ORM\Column(length: 255)]
private ?string $raisonsocial = null;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Ficheoffre::class, cascade: ["remove"])]
private Collection $ficheoffres;
#[ORM\Column(length: 255, nullable: true)]
private ?string $devise = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $adresse = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $fax = null;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Aiguilles::class, cascade: ["remove"])]
private Collection $aiguilles;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Platines::class, cascade: ["remove"])]
private Collection $platines;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Courroie::class, cascade: ["remove"])]
private Collection $courroie;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mf = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $rc = null;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Famillesdarticles::class, cascade: ["remove"])]
private Collection $famillesdarticles;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Archivearticle::class, cascade: ["remove"])]
private Collection $archivearticles;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Importdirect::class, cascade: ["remove"])]
private Collection $importdirects;
#[ORM\ManyToMany(targetEntity: Banque::class, inversedBy: 'fournisseurs')]
private Collection $banque;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Devis::class)]
private Collection $devis;
#[ORM\OneToMany(mappedBy: 'fournisseur', targetEntity: Ficheachatnf::class)]
private Collection $ficheachatnfs;
public function __construct()
{
$this->ficheoffres = new ArrayCollection();
$this->aiguilles = new ArrayCollection();
$this->platines = new ArrayCollection();
$this->courroie = new ArrayCollection();
$this->famillesdarticles = new ArrayCollection();
$this->archivearticles = new ArrayCollection();
$this->importdirects = new ArrayCollection();
$this->banque = new ArrayCollection();
$this->devis = new ArrayCollection();
$this->ficheachatnfs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
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 getTel(): ?string
{
return $this->tel;
}
public function setTel(string $tel): self
{
$this->tel = $tel;
return $this;
}
public function getRaisonsocial(): ?string
{
return $this->raisonsocial;
}
public function setRaisonsocial(string $raisonsocial): self
{
$this->raisonsocial = $raisonsocial;
return $this;
}
/**
* @return Collection<int, Ficheoffre>
*/
public function getFicheoffres(): Collection
{
return $this->ficheoffres;
}
public function getDevise(): ?string
{
return $this->devise;
}
public function setDevise(?string $devise): self
{
$this->devise = $devise;
return $this;
}
public function getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(?string $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getFax(): ?string
{
return $this->fax;
}
public function setFax(?string $fax): self
{
$this->fax = $fax;
return $this;
}
/**
* @return Collection<int, Aiguilles>
*/
public function getAiguilles(): Collection
{
return $this->aiguilles;
}
public function addAiguille(Aiguilles $aiguille): self
{
if (!$this->aiguilles->contains($aiguille)) {
$this->aiguilles->add($aiguille);
$aiguille->setFournisseur($this);
}
return $this;
}
public function removeAiguille(Aiguilles $aiguille): self
{
if ($this->aiguilles->removeElement($aiguille)) {
// set the owning side to null (unless already changed)
if ($aiguille->getFournisseur() === $this) {
$aiguille->setFournisseur(null);
}
}
return $this;
}
/**
* @return Collection<int, Platines>
*/
public function getPlatines(): Collection
{
return $this->platines;
}
public function addPlatine(Platines $platine): self
{
if (!$this->platines->contains($platine)) {
$this->platines->add($platine);
$platine->setFournisseur($this);
}
return $this;
}
public function removePlatine(Platines $platine): self
{
if ($this->platines->removeElement($platine)) {
// set the owning side to null (unless already changed)
if ($platine->getFournisseur() === $this) {
$platine->setFournisseur(null);
}
}
return $this;
}
/**
* @return Collection<int, Courroie>
*/
public function getCourroie(): Collection
{
return $this->courroie;
}
public function addCourroie(Courroie $courroie): self
{
if (!$this->courroie->contains($courroie)) {
$this->courroie->add($courroie);
$courroie->setFournisseur($this);
}
return $this;
}
public function removeCourroie(Courroie $courroie): self
{
if ($this->courroie->removeElement($courroie)) {
// set the owning side to null (unless already changed)
if ($courroie->getFournisseur() === $this) {
$courroie->setFournisseur(null);
}
}
return $this;
}
public function getMf(): ?string
{
return $this->mf;
}
public function setMf(?string $mf): self
{
$this->mf = $mf;
return $this;
}
public function getRc(): ?string
{
return $this->rc;
}
public function setRc(?string $rc): self
{
$this->rc = $rc;
return $this;
}
/**
* @return Collection<int, Famillesdarticles>
*/
public function getFamillesdarticles(): Collection
{
return $this->famillesdarticles;
}
public function addFamillesdarticle(Famillesdarticles $famillesdarticle): self
{
if (!$this->famillesdarticles->contains($famillesdarticle)) {
$this->famillesdarticles->add($famillesdarticle);
$famillesdarticle->setFournisseur($this);
}
return $this;
}
public function removeFamillesdarticle(Famillesdarticles $famillesdarticle): self
{
if ($this->famillesdarticles->removeElement($famillesdarticle)) {
// set the owning side to null (unless already changed)
if ($famillesdarticle->getFournisseur() === $this) {
$famillesdarticle->setFournisseur(null);
}
}
return $this;
}
/**
* @return Collection<int, Archivearticle>
*/
public function getArchivearticles(): Collection
{
return $this->archivearticles;
}
public function addArchivearticle(Archivearticle $archivearticle): static
{
if (!$this->archivearticles->contains($archivearticle)) {
$this->archivearticles->add($archivearticle);
$archivearticle->setFournisseur($this);
}
return $this;
}
public function removeArchivearticle(Archivearticle $archivearticle): static
{
if ($this->archivearticles->removeElement($archivearticle)) {
// set the owning side to null (unless already changed)
if ($archivearticle->getFournisseur() === $this) {
$archivearticle->setFournisseur(null);
}
}
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->setFournisseur($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->getFournisseur() === $this) {
$importdirect->setFournisseur(null);
}
}
return $this;
}
/**
* @return Collection<int, Banque>
*/
public function getBanque(): Collection
{
return $this->banque;
}
public function addBanque(Banque $banque): static
{
if (!$this->banque->contains($banque)) {
$this->banque->add($banque);
}
return $this;
}
public function removeBanque(Banque $banque): static
{
$this->banque->removeElement($banque);
return $this;
}
/**
* @return Collection<int, Devis>
*/
public function getDevis(): Collection
{
return $this->devis;
}
public function addDevi(Devis $devi): static
{
if (!$this->devis->contains($devi)) {
$this->devis->add($devi);
$devi->setFournisseur($this);
}
return $this;
}
public function removeDevi(Devis $devi): static
{
if ($this->devis->removeElement($devi)) {
// set the owning side to null (unless already changed)
if ($devi->getFournisseur() === $this) {
$devi->setFournisseur(null);
}
}
return $this;
}
/**
* @return Collection<int, Ficheachatnf>
*/
public function getFicheachatnfs(): Collection
{
return $this->ficheachatnfs;
}
public function addFicheachatnf(Ficheachatnf $ficheachatnf): self
{
if (!$this->ficheachatnfs->contains($ficheachatnf)) {
$this->ficheachatnfs->add($ficheachatnf);
$ficheachatnf->setFournisseur($this);
}
return $this;
}
public function removeFicheachatnf(Ficheachatnf $ficheachatnf): self
{
if ($this->ficheachatnfs->removeElement($ficheachatnf)) {
// set the owning side to null (unless already changed)
if ($ficheachatnf->getFournisseur() === $this) {
$ficheachatnf->setFournisseur(null);
}
}
return $this;
}
}