src/Entity/BonDeCommande.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BonDeCommandeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=BonDeCommandeRepository::class)
  9.  */
  10. class BonDeCommande
  11. {
  12.     const TYPE_COMMANDE_TAB = [
  13.         'Fourniture' => '1',
  14.         'Sous-traitance' => '2'
  15.     ];
  16.     const modalitePaiementTab = [
  17.         '30J date de facture' => '30J date de facture',
  18.         '30J Fin du mois' => '30J Fin du mois',
  19.         '45J Fin du mois' => '45J Fin du mois',
  20.         '60J Date de la facture' => '60J Date de la facture',
  21.         'Immédiat' => 'Immédiat',
  22.     ];
  23.     const TYPE_ENVOIE_COMMANDE_TAB = [
  24.         'Envoyer par mail au fournisseur/sous-traitant' => 'Envoyer par mail au fournisseur/sous-traitant',
  25.         'Envoyer par mail (champs libre)' => 'Envoyer par mail (champs libre)',
  26.         'Envoyer au commanditaire' => 'Envoyer au commanditaire'
  27.     ];
  28.     /**
  29.      * @ORM\Id
  30.      * @ORM\GeneratedValue
  31.      * @ORM\Column(type="integer")
  32.      */
  33.     private $id;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $numeroBonDecommande;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $token;
  42.     /**
  43.      * @ORM\Column(type="datetime", nullable=true)
  44.      */
  45.     private $createdAt;
  46.     /**
  47.      * @ORM\Column(type="string", length=255, nullable=true)
  48.      */
  49.     private $typeCommande;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity="Fournisseur", cascade={"persist"})
  52.      * @ORM\JoinColumn(name="fournisseur_id", referencedColumnName="id",nullable=true)
  53.      */
  54.     private $fournisseur;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      */
  58.     private $emailFournisseur;
  59.     /**
  60.      * @ORM\Column(type="string", length=255, nullable=true)
  61.      */
  62.     private $mobileFournisseur;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity="Spv", cascade={"persist"})
  65.      * @ORM\JoinColumn(name="spv_id", referencedColumnName="id",nullable=true)
  66.      */
  67.     private $spv;
  68.     /**
  69.      * @ORM\Column(type="string", length=255, nullable=true)
  70.      */
  71.     private $adresseSpv;
  72.     /**
  73.      * @ORM\Column(type="string", length=255, nullable=true)
  74.      */
  75.     private $emailSpv;
  76.     /**
  77.      * @ORM\Column(type="string", length=255, nullable=true)
  78.      */
  79.     private $mobileSpv;
  80.     /**
  81.      * @ORM\ManyToOne(targetEntity="User", cascade={"persist"})
  82.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id",nullable=true)
  83.      */
  84.     private $userContact;
  85.     /**
  86.      * @ORM\Column(type="string", length=255, nullable=true)
  87.      */
  88.     private $emailUserContact;
  89.     /**
  90.      * @ORM\Column(type="string", length=255, nullable=true)
  91.      */
  92.     private $mobileUserContact;
  93.     /**
  94.      * @ORM\Column(type="string", length=255, nullable=true)
  95.      */
  96.     private $adresseLivraison;
  97.     /**
  98.      * @ORM\Column(type="string", length=255, nullable=true)
  99.      */
  100.     private $codePostalLivraison;
  101.     /**
  102.      * @ORM\Column(type="string", length=255, nullable=true)
  103.      */
  104.     private $cityLivraison;
  105.     /**
  106.      * @ORM\Column(type="boolean", nullable=true)
  107.      */
  108.     private $isAdresseFournisseur;
  109.     /**
  110.      * @ORM\Column(type="datetime", nullable=true)
  111.      */
  112.     private $dateLivraisonSouhaitee;
  113.     /**
  114.      * @ORM\Column(type="datetime", nullable=true)
  115.      */
  116.     private $dateDebutTravauxSousTraitance;
  117.     /**
  118.      * @ORM\Column(type="datetime", nullable=true)
  119.      */
  120.     private $dateFinTravauxSousTraitance;
  121.     /**
  122.      * @ORM\Column(type="string", length=255, nullable=true)
  123.      */
  124.     private $modalitePaiement;
  125.     /**
  126.      * @ORM\Column(type="text", nullable=true)
  127.      */
  128.     private $information;
  129.     /**
  130.      * @ORM\Column(type="string", length=255, nullable=true)
  131.      */
  132.     private $numeroDevis;
  133.     /**
  134.      * @ORM\OneToMany(targetEntity="ProjectBonCommande",mappedBy="bonCommande", cascade={"persist"})
  135.      */
  136.     private $projectBonCommande;
  137.     /**
  138.      * @ORM\OneToMany(targetEntity="DetailBonCommande",mappedBy="bonCommande", cascade={"persist"})
  139.      */
  140.     private $detailBonCommande;
  141.     /**
  142.      * @ORM\Column(type="string", length=255, nullable=true)
  143.      */
  144.     private $pdfFile;
  145.     /**
  146.      * @ORM\Column(type="string", length=255, nullable=true)
  147.      */
  148.     private $modeEnvoieCommande;
  149.     /**
  150.      * @ORM\ManyToOne(targetEntity="DocUpload", cascade={"persist"})
  151.      * @ORM\JoinColumn(name="file_devis_bon_commande_id", referencedColumnName="id",nullable=true ,onDelete="SET NULL")
  152.      */
  153.     private $fileDevisBonCommande;
  154.     
  155.     public function __construct()
  156.     {
  157.         $this->createdAt = new \DateTime();
  158.         $this->token =  md5(uniqid());
  159.         $this->projectBonCommande = new ArrayCollection();
  160.         $this->detailBonCommande = new ArrayCollection();
  161.     }
  162.     public function getId(): ?int
  163.     {
  164.         return $this->id;
  165.     }
  166.     public function getToken(): ?string
  167.     {
  168.         return $this->token;
  169.     }
  170.     public function setToken(?string $token): self
  171.     {
  172.         $this->token = $token;
  173.         return $this;
  174.     }
  175.     public function getCreatedAt(): ?\DateTimeInterface
  176.     {
  177.         return $this->createdAt;
  178.     }
  179.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  180.     {
  181.         $this->createdAt = $createdAt;
  182.         return $this;
  183.     }
  184.     public function getTypeCommande(): ?string
  185.     {
  186.         return $this->typeCommande;
  187.     }
  188.     public function setTypeCommande(?string $typeCommande): self
  189.     {
  190.         $this->typeCommande = $typeCommande;
  191.         return $this;
  192.     }
  193.     public function getEmailFournisseur(): ?string
  194.     {
  195.         return $this->emailFournisseur;
  196.     }
  197.     public function setEmailFournisseur(?string $emailFournisseur): self
  198.     {
  199.         $this->emailFournisseur = $emailFournisseur;
  200.         return $this;
  201.     }
  202.     public function getMobileFournisseur(): ?string
  203.     {
  204.         return $this->mobileFournisseur;
  205.     }
  206.     public function setMobileFournisseur(?string $mobileFournisseur): self
  207.     {
  208.         $this->mobileFournisseur = $mobileFournisseur;
  209.         return $this;
  210.     }
  211.     public function getAdresseSpv(): ?string
  212.     {
  213.         return $this->adresseSpv;
  214.     }
  215.     public function setAdresseSpv(?string $adresseSpv): self
  216.     {
  217.         $this->adresseSpv = $adresseSpv;
  218.         return $this;
  219.     }
  220.     public function getEmailSpv(): ?string
  221.     {
  222.         return $this->emailSpv;
  223.     }
  224.     public function setEmailSpv(?string $emailSpv): self
  225.     {
  226.         $this->emailSpv = $emailSpv;
  227.         return $this;
  228.     }
  229.     public function getMobileSpv(): ?string
  230.     {
  231.         return $this->mobileSpv;
  232.     }
  233.     public function setMobileSpv(?string $mobileSpv): self
  234.     {
  235.         $this->mobileSpv = $mobileSpv;
  236.         return $this;
  237.     }
  238.     public function getEmailUserContact(): ?string
  239.     {
  240.         return $this->emailUserContact;
  241.     }
  242.     public function setEmailUserContact(?string $emailUserContact): self
  243.     {
  244.         $this->emailUserContact = $emailUserContact;
  245.         return $this;
  246.     }
  247.     public function getMobileUserContact(): ?string
  248.     {
  249.         return $this->mobileUserContact;
  250.     }
  251.     public function setMobileUserContact(?string $mobileUserContact): self
  252.     {
  253.         $this->mobileUserContact = $mobileUserContact;
  254.         return $this;
  255.     }
  256.     public function getAdresseLivraison(): ?string
  257.     {
  258.         return $this->adresseLivraison;
  259.     }
  260.     public function setAdresseLivraison(?string $adresseLivraison): self
  261.     {
  262.         $this->adresseLivraison = $adresseLivraison;
  263.         return $this;
  264.     }
  265.     public function getDateLivraisonSouhaitee(): ?\DateTimeInterface
  266.     {
  267.         return $this->dateLivraisonSouhaitee;
  268.     }
  269.     public function setDateLivraisonSouhaitee(?\DateTimeInterface $dateLivraisonSouhaitee): self
  270.     {
  271.         $this->dateLivraisonSouhaitee = $dateLivraisonSouhaitee;
  272.         return $this;
  273.     }
  274.     public function getDateDebutTravauxSousTraitance(): ?\DateTimeInterface
  275.     {
  276.         return $this->dateDebutTravauxSousTraitance;
  277.     }
  278.     public function setDateDebutTravauxSousTraitance(?\DateTimeInterface $dateDebutTravauxSousTraitance): self
  279.     {
  280.         $this->dateDebutTravauxSousTraitance = $dateDebutTravauxSousTraitance;
  281.         return $this;
  282.     }
  283.     public function getDateFinTravauxSousTraitance(): ?\DateTimeInterface
  284.     {
  285.         return $this->dateFinTravauxSousTraitance;
  286.     }
  287.     public function setDateFinTravauxSousTraitance(?\DateTimeInterface $dateFinTravauxSousTraitance): self
  288.     {
  289.         $this->dateFinTravauxSousTraitance = $dateFinTravauxSousTraitance;
  290.         return $this;
  291.     }
  292.     public function getModalitePaiement(): ?string
  293.     {
  294.         return $this->modalitePaiement;
  295.     }
  296.     public function setModalitePaiement(?string $modalitePaiement): self
  297.     {
  298.         $this->modalitePaiement = $modalitePaiement;
  299.         return $this;
  300.     }
  301.     public function getInformation(): ?string
  302.     {
  303.         return $this->information;
  304.     }
  305.     public function setInformation(?string $information): self
  306.     {
  307.         $this->information = $information;
  308.         return $this;
  309.     }
  310.     public function getNumeroDevis(): ?string
  311.     {
  312.         return $this->numeroDevis;
  313.     }
  314.     public function setNumeroDevis(?string $numeroDevis): self
  315.     {
  316.         $this->numeroDevis = $numeroDevis;
  317.         return $this;
  318.     }
  319.     public function getPdfFile(): ?string
  320.     {
  321.         return $this->pdfFile;
  322.     }
  323.     public function setPdfFile(?string $pdfFile): self
  324.     {
  325.         $this->pdfFile = $pdfFile;
  326.         return $this;
  327.     }
  328.     public function getFournisseur(): ?Fournisseur
  329.     {
  330.         return $this->fournisseur;
  331.     }
  332.     public function setFournisseur(?Fournisseur $fournisseur): self
  333.     {
  334.         $this->fournisseur = $fournisseur;
  335.         return $this;
  336.     }
  337.     public function getSpv(): ?Spv
  338.     {
  339.         return $this->spv;
  340.     }
  341.     public function setSpv(?Spv $spv): self
  342.     {
  343.         $this->spv = $spv;
  344.         return $this;
  345.     }
  346.     public function getUserContact(): ?User
  347.     {
  348.         return $this->userContact;
  349.     }
  350.     public function setUserContact(?User $userContact): self
  351.     {
  352.         $this->userContact = $userContact;
  353.         return $this;
  354.     }
  355.     /**
  356.      * @return Collection|ProjectBonCommande[]
  357.      */
  358.     public function getProjectBonCommande(): Collection
  359.     {
  360.         return $this->projectBonCommande;
  361.     }
  362.     public function addProjectBonCommande(ProjectBonCommande $projectBonCommande): self
  363.     {
  364.         if (!$this->projectBonCommande->contains($projectBonCommande)) {
  365.             $this->projectBonCommande[] = $projectBonCommande;
  366.             $projectBonCommande->setBonCommande($this);
  367.         }
  368.         return $this;
  369.     }
  370.     public function removeProjectBonCommande(ProjectBonCommande $projectBonCommande): self
  371.     {
  372.         if ($this->projectBonCommande->removeElement($projectBonCommande)) {
  373.             // set the owning side to null (unless already changed)
  374.             if ($projectBonCommande->getBonCommande() === $this) {
  375.                 $projectBonCommande->setBonCommande(null);
  376.             }
  377.         }
  378.         return $this;
  379.     }
  380.     /**
  381.      * @return Collection|DetailBonCommande[]
  382.      */
  383.     public function getDetailBonCommande(): Collection
  384.     {
  385.         return $this->detailBonCommande;
  386.     }
  387.     public function addDetailBonCommande(DetailBonCommande $detailBonCommande): self
  388.     {
  389.         if (!$this->detailBonCommande->contains($detailBonCommande)) {
  390.             $this->detailBonCommande[] = $detailBonCommande;
  391.             $detailBonCommande->setBonCommande($this);
  392.         }
  393.         return $this;
  394.     }
  395.     public function removeDetailBonCommande(DetailBonCommande $detailBonCommande): self
  396.     {
  397.         if ($this->detailBonCommande->removeElement($detailBonCommande)) {
  398.             // set the owning side to null (unless already changed)
  399.             if ($detailBonCommande->getBonCommande() === $this) {
  400.                 $detailBonCommande->setBonCommande(null);
  401.             }
  402.         }
  403.         return $this;
  404.     }
  405.     public function getCodePostalLivraison(): ?string
  406.     {
  407.         return $this->codePostalLivraison;
  408.     }
  409.     public function setCodePostalLivraison(?string $codePostalLivraison): self
  410.     {
  411.         $this->codePostalLivraison = $codePostalLivraison;
  412.         return $this;
  413.     }
  414.     public function getCityLivraison(): ?string
  415.     {
  416.         return $this->cityLivraison;
  417.     }
  418.     public function setCityLivraison(?string $cityLivraison): self
  419.     {
  420.         $this->cityLivraison = $cityLivraison;
  421.         return $this;
  422.     }
  423.     public function getIsAdresseFournisseur(): ?bool
  424.     {
  425.         return $this->isAdresseFournisseur;
  426.     }
  427.     public function setIsAdresseFournisseur(?bool $isAdresseFournisseur): self
  428.     {
  429.         $this->isAdresseFournisseur = $isAdresseFournisseur;
  430.         return $this;
  431.     }
  432.     public function getModeEnvoieCommande(): ?string
  433.     {
  434.         return $this->modeEnvoieCommande;
  435.     }
  436.     public function setModeEnvoieCommande(?string $modeEnvoieCommande): self
  437.     {
  438.         $this->modeEnvoieCommande = $modeEnvoieCommande;
  439.         return $this;
  440.     }
  441.     public function getFileDevisBonCommande(): ?DocUpload
  442.     {
  443.         return $this->fileDevisBonCommande;
  444.     }
  445.     public function setFileDevisBonCommande(?DocUpload $fileDevisBonCommande): self
  446.     {
  447.         $this->fileDevisBonCommande = $fileDevisBonCommande;
  448.         return $this;
  449.     }
  450.     public function getNumeroBonDecommande(): ?string
  451.     {
  452.         return $this->numeroBonDecommande;
  453.     }
  454.     public function setNumeroBonDecommande(?string $numeroBonDecommande): self
  455.     {
  456.         $this->numeroBonDecommande = $numeroBonDecommande;
  457.         return $this;
  458.     }
  459. }