src/Entity/Entreprise.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EntrepriseRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=EntrepriseRepository::class)
  11.  * @UniqueEntity (
  12.  *     fields={"siret"},
  13.  *     message="Cette entreprise existe déjà"
  14.  * )
  15.  */
  16. class Entreprise
  17. {
  18.     
  19.     public const FORME_EI 'EI';
  20.     public const FORME_EIRL 'EIRL ';
  21.     public const FORME_EURL 'EURL';
  22.     public const FORME_SARL 'SARL';
  23.     public const FORME_SA 'SA';
  24.     public const FORME_SASU 'SASU';
  25.     public const FORME_SAS 'SAS';
  26.     public const FORME_ASSOCIATION 'ASSOCIATION';
  27.     public const FORME_SYNDICAT 'SYNDICAT';
  28.     public const FORME_SCS 'SCS';
  29.     public const FORME_SNC 'SNC';
  30.     public const FORME_SCI 'SCI';
  31.     public const FORME_SCM 'SCM';
  32.     public const FORME_SCP 'SCP';
  33.     public const FORME_SCA 'SCA';
  34.     public const FORME_SELARL 'SELARL';
  35.     public const FORME_SELAFA 'SELAFA';
  36.     public const FORME_SELAS 'SELAS';
  37.     public const FORME_SELCA 'SELCA';
  38.     public const FORMES_JURIDIQUES = [
  39.         self::FORME_EI,
  40.         self::FORME_EIRL,
  41.         self::FORME_EURL,
  42.         self::FORME_SARL,
  43.         self::FORME_SA,
  44.         self::FORME_SASU,
  45.         self::FORME_SAS,
  46.         self::FORME_ASSOCIATION,
  47.         self::FORME_SYNDICAT,
  48.         self::FORME_SAS,
  49.         self::FORME_SNC,
  50.         self::FORME_SCS,
  51.         self::FORME_SCI,
  52.         self::FORME_SCM,
  53.         self::FORME_SCP,
  54.         self::FORME_SCA,
  55.         self::FORME_SELARL,
  56.         self::FORME_SELAFA,
  57.         self::FORME_SELAS,
  58.         self::FORME_SELCA,
  59.     ];
  60.     public const CIVILITE_AUTRE '';
  61.     public const CIVILITE_M 'M.';
  62.     public const CIVILITE_MME 'Mme';
  63.     public const CIVILITES = [
  64.         self::CIVILITE_AUTRE,
  65.         self::CIVILITE_M,
  66.         self::CIVILITE_MME
  67.     ];
  68.     /**
  69.      * @ORM\Id
  70.      * @ORM\GeneratedValue
  71.      * @ORM\Column(type="integer")
  72.      */
  73.     private $id;
  74.     /**
  75.      * @ORM\Column(type="string", length=255)
  76.      */
  77.     private $raisonSociale;
  78.     /**
  79.      * @ORM\Column(type="string", length=255, nullable=false)
  80.      * @Assert\Length(
  81.      *      min = 14,
  82.      *      max = 14,
  83.      *      minMessage = "Le numéro siret doit comporter exactement {{ limit }} chiffres",
  84.      *      maxMessage = "Le numéro siret doit comporter exactement {{ limit }} chiffres"
  85.      * )
  86.      * @Assert\NotBlank
  87.      * 
  88.      */
  89.     private $siret;
  90.     /**
  91.      * @ORM\OneToMany(targetEntity=Dossier::class, mappedBy="entreprise")
  92.      */
  93.     private $dossiers;
  94.     
  95.     /**
  96.      * @ORM\ManyToOne(targetEntity=Reseau::class, inversedBy="entreprises")
  97.      */
  98.     private $reseau;
  99.     /**
  100.      * @ORM\ManyToOne(targetEntity=ReseauDivision::class, inversedBy="entreprises")
  101.      */
  102.     private $reseauDivision;
  103.     /**
  104.      * @ORM\ManyToOne(targetEntity=Commercial::class, inversedBy="entreprises")
  105.      */
  106.     private $commercial;
  107.     /**
  108.      * @ORM\Column(type="string", length=255, nullable=true)
  109.      */
  110.     private $formeJuridique;
  111.     /**
  112.      * @ORM\ManyToOne(targetEntity=Activite::class)
  113.      */
  114.     private $activite;
  115.     /**
  116.      * @ORM\Column(type="string", length=255, nullable=true)
  117.      */
  118.     private $contactNom;
  119.     /**
  120.      * @ORM\Column(type="string", length=255, nullable=true)
  121.      */
  122.     private $contactPrenom;
  123.     /**
  124.      * @ORM\Column(type="string", length=255, nullable=true)
  125.      */
  126.     private $contactTelephone;
  127.     /**
  128.      * @ORM\Column(type="string", length=255, nullable=true)
  129.      */
  130.     private $contactEmail;
  131.     /**
  132.      * @ORM\Column(type="string", length=255, nullable=true)
  133.      */
  134.     private $contactQualite;
  135.     /**
  136.      * @ORM\Column(type="string", length=255, nullable=true)
  137.      */
  138.     private $contactCivilite;
  139.     /**
  140.      * @ORM\Column(type="string", length=255, nullable=true)
  141.      */
  142.     private $adresse;
  143.     /**
  144.      * @ORM\Column(type="string", length=255, nullable=true)
  145.      */
  146.     private $codePostal;
  147.     /**
  148.      * @ORM\Column(type="string", length=255, nullable=true)
  149.      */
  150.     private $commune;
  151.     /**
  152.      * @ORM\OneToOne(targetEntity=CommercialEntreprise::class, mappedBy="entreprise", cascade={"persist", "remove"})
  153.      */
  154.     private $commercialEntreprise;
  155.     /*
  156.      * Propriétés non managées
  157.      */
  158.     
  159.     private $producteurCodeIsWaiting;
  160.     private $producteurCode;
  161.     private $producteurNom;
  162.     private $producteurPrenom;
  163.     private $producteurEmail;
  164.     private $producteurTelephone;
  165.     public function __construct()
  166.     {
  167.         $this->dossiers = new ArrayCollection();
  168.     }
  169.     public function __toString() {
  170.         return $this->raisonSociale  ;
  171.     }
  172.     public function getContactName() {
  173.         return $this->contactPrenom " " $this->contactNom;
  174.     }
  175.     public function getId(): ?int
  176.     {
  177.         return $this->id;
  178.     }
  179.     
  180.     public function getReseau(): ?Reseau
  181.     {
  182.         return $this->reseau;
  183.     }
  184.     public function setReseau(?Reseau $reseau): self
  185.     {
  186.         $this->reseau $reseau;
  187.         return $this;
  188.     }
  189.     public function getReseauDivision(): ?ReseauDivision
  190.     {
  191.         return $this->reseauDivision;
  192.     }
  193.     public function setReseauDivision(?ReseauDivision $reseauDivision): self
  194.     {
  195.         $this->reseauDivision $reseauDivision;
  196.         return $this;
  197.     }
  198.     
  199.     public function getRaisonSociale(): ?string
  200.     {
  201.         return $this->raisonSociale;
  202.     }
  203.     public function setRaisonSociale(string $raisonSociale): self
  204.     {
  205.         $this->raisonSociale $raisonSociale;
  206.         return $this;
  207.     }
  208.     public function getSiret(): ?string
  209.     {
  210.         return $this->siret;
  211.     }
  212.     public function setSiret(?string $siret): self
  213.     {
  214.         $this->siret $siret;
  215.         return $this;
  216.     }
  217.     /**
  218.      * @return Collection|Dossier[]
  219.      */
  220.     public function getDossiers(): Collection
  221.     {
  222.         return $this->dossiers;
  223.     }
  224.     public function addDossier(Dossier $dossier): self
  225.     {
  226.         if (!$this->dossiers->contains($dossier)) {
  227.             $this->dossiers[] = $dossier;
  228.             $dossier->setEntreprise($this);
  229.         }
  230.         return $this;
  231.     }
  232.     public function removeDossier(Dossier $dossier): self
  233.     {
  234.         if ($this->dossiers->removeElement($dossier)) {
  235.             // set the owning side to null (unless already changed)
  236.             if ($dossier->getEntreprise() === $this) {
  237.                 $dossier->setEntreprise(null);
  238.             }
  239.         }
  240.         return $this;
  241.     }
  242.     public function countDossiers(): Int
  243.     {
  244.         return count($this->dossiers);
  245.     }
  246.     public function getCommercial(): ?Commercial
  247.     {
  248.         return $this->commercial;
  249.     }
  250.     public function setCommercial(?Commercial $commercial): self
  251.     {
  252.         $this->commercial $commercial;
  253.         return $this;
  254.     }
  255.     public function getFormeJuridique(): ?string
  256.     {
  257.         return $this->formeJuridique;
  258.     }
  259.     public function setFormeJuridique(?string $formeJuridique): self
  260.     {
  261.         $this->formeJuridique $formeJuridique;
  262.         return $this;
  263.     }
  264.     public function getActivite(): ?Activite
  265.     {
  266.         return $this->activite;
  267.     }
  268.     public function setActivite(?Activite $activite): self
  269.     {
  270.         $this->activite $activite;
  271.         return $this;
  272.     }
  273.     public function getContactNom(): ?string
  274.     {
  275.         return $this->contactNom;
  276.     }
  277.     public function setContactNom(?string $contactNom): self
  278.     {
  279.         $this->contactNom $contactNom;
  280.         return $this;
  281.     }
  282.     public function getContactPrenom(): ?string
  283.     {
  284.         return $this->contactPrenom;
  285.     }
  286.     public function setContactPrenom(?string $contactPrenom): self
  287.     {
  288.         $this->contactPrenom $contactPrenom;
  289.         return $this;
  290.     }
  291.     public function getContactTelephone(): ?string
  292.     {
  293.         return $this->contactTelephone;
  294.     }
  295.     public function setContactTelephone(?string $contactTelephone): self
  296.     {
  297.         $this->contactTelephone $contactTelephone;
  298.         return $this;
  299.     }
  300.     public function getContactEmail(): ?string
  301.     {
  302.         return $this->contactEmail;
  303.     }
  304.     public function setContactEmail(?string $contactEmail): self
  305.     {
  306.         $this->contactEmail $contactEmail;
  307.         return $this;
  308.     }
  309.     public function getContactQualite(): ?string
  310.     {
  311.         return $this->contactQualite;
  312.     }
  313.     public function setContactQualite(?string $contactQualite): self
  314.     {
  315.         $this->contactQualite $contactQualite;
  316.         return $this;
  317.     }
  318.     public function getContactCivilite(): ?string
  319.     {
  320.         return $this->contactCivilite;
  321.     }
  322.     public function setContactCivilite(?string $contactCivilite): self
  323.     {
  324.         $this->contactCivilite $contactCivilite;
  325.         return $this;
  326.     }
  327.     public function getAdresse(): ?string
  328.     {
  329.         return $this->adresse;
  330.     }
  331.     public function setAdresse(?string $adresse): self
  332.     {
  333.         $this->adresse $adresse;
  334.         return $this;
  335.     }
  336.     public function getCodePostal(): ?string
  337.     {
  338.         return $this->codePostal;
  339.     }
  340.     public function setCodePostal(?string $codePostal): self
  341.     {
  342.         $this->codePostal $codePostal;
  343.         return $this;
  344.     }
  345.     public function getCommune(): ?string
  346.     {
  347.         return $this->commune;
  348.     }
  349.     public function setCommune(?string $commune): self
  350.     {
  351.         $this->commune $commune;
  352.         return $this;
  353.     }
  354.     
  355.     public function getProducteurCodeIsWaiting(): ?bool
  356.     {
  357.         return $this->producteurCodeIsWaiting;
  358.     }
  359.     public function setProducteurCodeIsWaiting(?bool $producteurCodeIsWaiting): self
  360.     {
  361.         $this->producteurCodeIsWaiting $producteurCodeIsWaiting;
  362.         return $this;
  363.     }
  364.     public function getProducteurCode(): ?string
  365.     {
  366.         return $this->producteurCode;
  367.     }
  368.     public function setProducteurCode(?string $producteurCode): self
  369.     {
  370.         $this->producteurCode $producteurCode;
  371.         return $this;
  372.     }
  373.     public function getProducteurNom(): ?string
  374.     {
  375.         return $this->producteurNom;
  376.     }
  377.     public function setProducteurNom(?string $producteurNom): self
  378.     {
  379.         $this->producteurNom $producteurNom;
  380.         return $this;
  381.     }
  382.     public function getProducteurPrenom(): ?string
  383.     {
  384.         return $this->producteurPrenom;
  385.     }
  386.     public function setProducteurPrenom(?string $producteurPrenom): self
  387.     {
  388.         $this->producteurPrenom $producteurPrenom;
  389.         return $this;
  390.     }
  391.     public function getProducteurEmail(): ?string
  392.     {
  393.         return $this->producteurEmail;
  394.     }
  395.     public function setProducteurEmail(?string $producteurEmail): self
  396.     {
  397.         $this->producteurEmail $producteurEmail;
  398.         return $this;
  399.     }
  400.     public function getProducteurTelephone(): ?string
  401.     {
  402.         return $this->producteurTelephone;
  403.     }
  404.     public function setProducteurTelephone(?string $producteurTelephone): self
  405.     {
  406.         $this->producteurTelephone $producteurTelephone;
  407.         return $this;
  408.     }
  409.     public function getCommercialEntreprise(): ?CommercialEntreprise
  410.     {
  411.         return $this->commercialEntreprise;
  412.     }
  413.     public function setCommercialEntreprise(?CommercialEntreprise $commercialEntreprise): self
  414.     {
  415.         // unset the owning side of the relation if necessary
  416.         if ($commercialEntreprise === null && $this->commercialEntreprise !== null) {
  417.             $this->commercialEntreprise->setEntreprise(null);
  418.         }
  419.         // set the owning side of the relation if necessary
  420.         if ($commercialEntreprise !== null && $commercialEntreprise->getEntreprise() !== $this) {
  421.             $commercialEntreprise->setEntreprise($this);
  422.         }
  423.         $this->commercialEntreprise $commercialEntreprise;
  424.         return $this;
  425.     }
  426. }