<?php
namespace App\Entity;
use App\Repository\EntrepriseRepository;
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\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=EntrepriseRepository::class)
* @UniqueEntity (
* fields={"siret"},
* message="Cette entreprise existe déjà"
* )
*/
class Entreprise
{
public const FORME_EI = 'EI';
public const FORME_EIRL = 'EIRL ';
public const FORME_EURL = 'EURL';
public const FORME_SARL = 'SARL';
public const FORME_SA = 'SA';
public const FORME_SASU = 'SASU';
public const FORME_SAS = 'SAS';
public const FORME_ASSOCIATION = 'ASSOCIATION';
public const FORME_SYNDICAT = 'SYNDICAT';
public const FORME_SCS = 'SCS';
public const FORME_SNC = 'SNC';
public const FORME_SCI = 'SCI';
public const FORME_SCM = 'SCM';
public const FORME_SCP = 'SCP';
public const FORME_SCA = 'SCA';
public const FORME_SELARL = 'SELARL';
public const FORME_SELAFA = 'SELAFA';
public const FORME_SELAS = 'SELAS';
public const FORME_SELCA = 'SELCA';
public const FORMES_JURIDIQUES = [
self::FORME_EI,
self::FORME_EIRL,
self::FORME_EURL,
self::FORME_SARL,
self::FORME_SA,
self::FORME_SASU,
self::FORME_SAS,
self::FORME_ASSOCIATION,
self::FORME_SYNDICAT,
self::FORME_SAS,
self::FORME_SNC,
self::FORME_SCS,
self::FORME_SCI,
self::FORME_SCM,
self::FORME_SCP,
self::FORME_SCA,
self::FORME_SELARL,
self::FORME_SELAFA,
self::FORME_SELAS,
self::FORME_SELCA,
];
public const CIVILITE_AUTRE = '';
public const CIVILITE_M = 'M.';
public const CIVILITE_MME = 'Mme';
public const CIVILITES = [
self::CIVILITE_AUTRE,
self::CIVILITE_M,
self::CIVILITE_MME
];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $raisonSociale;
/**
* @ORM\Column(type="string", length=255, nullable=false)
* @Assert\Length(
* min = 14,
* max = 14,
* minMessage = "Le numéro siret doit comporter exactement {{ limit }} chiffres",
* maxMessage = "Le numéro siret doit comporter exactement {{ limit }} chiffres"
* )
* @Assert\NotBlank
*
*/
private $siret;
/**
* @ORM\OneToMany(targetEntity=Dossier::class, mappedBy="entreprise")
*/
private $dossiers;
/**
* @ORM\ManyToOne(targetEntity=Reseau::class, inversedBy="entreprises")
*/
private $reseau;
/**
* @ORM\ManyToOne(targetEntity=ReseauDivision::class, inversedBy="entreprises")
*/
private $reseauDivision;
/**
* @ORM\ManyToOne(targetEntity=Commercial::class, inversedBy="entreprises")
*/
private $commercial;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $formeJuridique;
/**
* @ORM\ManyToOne(targetEntity=Activite::class)
*/
private $activite;
/**
* @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 $contactTelephone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contactEmail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contactQualite;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contactCivilite;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $adresse;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $codePostal;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $commune;
/**
* @ORM\OneToOne(targetEntity=CommercialEntreprise::class, mappedBy="entreprise", cascade={"persist", "remove"})
*/
private $commercialEntreprise;
/*
* Propriétés non managées
*/
private $producteurCodeIsWaiting;
private $producteurCode;
private $producteurNom;
private $producteurPrenom;
private $producteurEmail;
private $producteurTelephone;
public function __construct()
{
$this->dossiers = new ArrayCollection();
}
public function __toString() {
return $this->raisonSociale ;
}
public function getContactName() {
return $this->contactPrenom . " " . $this->contactNom;
}
public function getId(): ?int
{
return $this->id;
}
public function getReseau(): ?Reseau
{
return $this->reseau;
}
public function setReseau(?Reseau $reseau): self
{
$this->reseau = $reseau;
return $this;
}
public function getReseauDivision(): ?ReseauDivision
{
return $this->reseauDivision;
}
public function setReseauDivision(?ReseauDivision $reseauDivision): self
{
$this->reseauDivision = $reseauDivision;
return $this;
}
public function getRaisonSociale(): ?string
{
return $this->raisonSociale;
}
public function setRaisonSociale(string $raisonSociale): self
{
$this->raisonSociale = $raisonSociale;
return $this;
}
public function getSiret(): ?string
{
return $this->siret;
}
public function setSiret(?string $siret): self
{
$this->siret = $siret;
return $this;
}
/**
* @return Collection|Dossier[]
*/
public function getDossiers(): Collection
{
return $this->dossiers;
}
public function addDossier(Dossier $dossier): self
{
if (!$this->dossiers->contains($dossier)) {
$this->dossiers[] = $dossier;
$dossier->setEntreprise($this);
}
return $this;
}
public function removeDossier(Dossier $dossier): self
{
if ($this->dossiers->removeElement($dossier)) {
// set the owning side to null (unless already changed)
if ($dossier->getEntreprise() === $this) {
$dossier->setEntreprise(null);
}
}
return $this;
}
public function countDossiers(): Int
{
return count($this->dossiers);
}
public function getCommercial(): ?Commercial
{
return $this->commercial;
}
public function setCommercial(?Commercial $commercial): self
{
$this->commercial = $commercial;
return $this;
}
public function getFormeJuridique(): ?string
{
return $this->formeJuridique;
}
public function setFormeJuridique(?string $formeJuridique): self
{
$this->formeJuridique = $formeJuridique;
return $this;
}
public function getActivite(): ?Activite
{
return $this->activite;
}
public function setActivite(?Activite $activite): self
{
$this->activite = $activite;
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 getContactTelephone(): ?string
{
return $this->contactTelephone;
}
public function setContactTelephone(?string $contactTelephone): self
{
$this->contactTelephone = $contactTelephone;
return $this;
}
public function getContactEmail(): ?string
{
return $this->contactEmail;
}
public function setContactEmail(?string $contactEmail): self
{
$this->contactEmail = $contactEmail;
return $this;
}
public function getContactQualite(): ?string
{
return $this->contactQualite;
}
public function setContactQualite(?string $contactQualite): self
{
$this->contactQualite = $contactQualite;
return $this;
}
public function getContactCivilite(): ?string
{
return $this->contactCivilite;
}
public function setContactCivilite(?string $contactCivilite): self
{
$this->contactCivilite = $contactCivilite;
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 getCommune(): ?string
{
return $this->commune;
}
public function setCommune(?string $commune): self
{
$this->commune = $commune;
return $this;
}
public function getProducteurCodeIsWaiting(): ?bool
{
return $this->producteurCodeIsWaiting;
}
public function setProducteurCodeIsWaiting(?bool $producteurCodeIsWaiting): self
{
$this->producteurCodeIsWaiting = $producteurCodeIsWaiting;
return $this;
}
public function getProducteurCode(): ?string
{
return $this->producteurCode;
}
public function setProducteurCode(?string $producteurCode): self
{
$this->producteurCode = $producteurCode;
return $this;
}
public function getProducteurNom(): ?string
{
return $this->producteurNom;
}
public function setProducteurNom(?string $producteurNom): self
{
$this->producteurNom = $producteurNom;
return $this;
}
public function getProducteurPrenom(): ?string
{
return $this->producteurPrenom;
}
public function setProducteurPrenom(?string $producteurPrenom): self
{
$this->producteurPrenom = $producteurPrenom;
return $this;
}
public function getProducteurEmail(): ?string
{
return $this->producteurEmail;
}
public function setProducteurEmail(?string $producteurEmail): self
{
$this->producteurEmail = $producteurEmail;
return $this;
}
public function getProducteurTelephone(): ?string
{
return $this->producteurTelephone;
}
public function setProducteurTelephone(?string $producteurTelephone): self
{
$this->producteurTelephone = $producteurTelephone;
return $this;
}
public function getCommercialEntreprise(): ?CommercialEntreprise
{
return $this->commercialEntreprise;
}
public function setCommercialEntreprise(?CommercialEntreprise $commercialEntreprise): self
{
// unset the owning side of the relation if necessary
if ($commercialEntreprise === null && $this->commercialEntreprise !== null) {
$this->commercialEntreprise->setEntreprise(null);
}
// set the owning side of the relation if necessary
if ($commercialEntreprise !== null && $commercialEntreprise->getEntreprise() !== $this) {
$commercialEntreprise->setEntreprise($this);
}
$this->commercialEntreprise = $commercialEntreprise;
return $this;
}
}