src/Entity/Engagement/EngagementBudgetEngage.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Engagement;
  3. use App\Entity\BonDeCommande;
  4. use App\Entity\DocUpload;
  5. use App\Entity\Fournisseur;
  6. use App\Repository\EngagementBudgetEngageRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use App\Annotation\CustomAnnotation;
  11. /**
  12.  * @ORM\Entity(repositoryClass=EngagementBudgetEngageRepository::class)
  13.  */
  14. class EngagementBudgetEngage
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="float", nullable=true)
  24.      * @CustomAnnotation("Montant total engagĂ©")
  25.      */
  26.     private $engageMontant;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity="\App\Entity\DocUpload", cascade={"persist"})
  29.      * @ORM\JoinColumn(name="file_devis_id", referencedColumnName="id",nullable=true,onDelete="SET NULL")
  30.      * @CustomAnnotation("Devis")
  31.      */
  32.     private $devis;
  33.     /**
  34.      * @ORM\ManyToOne(targetEntity="\App\Entity\BonDeCommande", cascade={"persist"})
  35.      * @ORM\JoinColumn(name="bon_commande_id", referencedColumnName="id",nullable=true,onDelete="SET NULL")
  36.      * @CustomAnnotation("Bon De Commande")
  37.      */
  38.     private $bonDeCommande;
  39.     /**
  40.      * @ORM\Column(type="datetime", nullable=true)
  41.      */
  42.     private $createdAt;
  43.     /**
  44.      * @ORM\Column(type="text", nullable=true)
  45.      */
  46.     private $token;
  47.     /**
  48.      * @ORM\Column(type="text", nullable=true)
  49.      * @CustomAnnotation("Note interne")
  50.      */
  51.     private $noteInterne;
  52.     /**
  53.      * @ORM\OneToMany(targetEntity="EngagementBudgetEngageComment",mappedBy="engagementBudgetEngage", cascade={"persist"})
  54.      */
  55.     private $comment;
  56.     /**
  57.      * @ORM\OneToMany(targetEntity="EngagementBudgetEngageDetail",mappedBy="engagementBudgetEngage", cascade={"persist"})
  58.      */
  59.     private $engagementBudgetEngageDetail;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity="\App\Entity\Fournisseur", cascade={"persist"})
  62.      * @ORM\JoinColumn(name="fournisseur_id", referencedColumnName="id",nullable=true)
  63.      * @CustomAnnotation("Fournisseur")
  64.      */
  65.     private $fournisseur;
  66.     public function __construct()
  67.     {
  68.         $this->createdAt = new \DateTime();
  69.         $this->token =  md5(uniqid());
  70.         $this->comment = new ArrayCollection();
  71.         $this->engagementBudgetEngageDetail = new ArrayCollection();
  72.     }
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     public function getEngageMontant(): ?float
  78.     {
  79.         return $this->engageMontant;
  80.     }
  81.     public function setEngageMontant(?float $engageMontant): self
  82.     {
  83.         $this->engageMontant = $engageMontant;
  84.         return $this;
  85.     }
  86.     public function getCreatedAt(): ?\DateTimeInterface
  87.     {
  88.         return $this->createdAt;
  89.     }
  90.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  91.     {
  92.         $this->createdAt = $createdAt;
  93.         return $this;
  94.     }
  95.     public function getToken(): ?string
  96.     {
  97.         return $this->token;
  98.     }
  99.     public function setToken(?string $token): self
  100.     {
  101.         $this->token = $token;
  102.         return $this;
  103.     }
  104.     public function getNoteInterne(): ?string
  105.     {
  106.         return $this->noteInterne;
  107.     }
  108.     public function setNoteInterne(?string $noteInterne): self
  109.     {
  110.         $this->noteInterne = $noteInterne;
  111.         return $this;
  112.     }
  113.     public function getDevis(): ?DocUpload
  114.     {
  115.         return $this->devis;
  116.     }
  117.     public function setDevis(?DocUpload $devis): self
  118.     {
  119.         $this->devis = $devis;
  120.         return $this;
  121.     }
  122.     public function getBonDeCommande(): ?BonDeCommande
  123.     {
  124.         return $this->bonDeCommande;
  125.     }
  126.     public function setBonDeCommande(?BonDeCommande $bonDeCommande): self
  127.     {
  128.         $this->bonDeCommande = $bonDeCommande;
  129.         return $this;
  130.     }
  131.     /**
  132.      * @return Collection|EngagementBudgetEngageComment[]
  133.      */
  134.     public function getComment(): Collection
  135.     {
  136.         return $this->comment;
  137.     }
  138.     public function addComment(EngagementBudgetEngageComment $comment): self
  139.     {
  140.         if (!$this->comment->contains($comment)) {
  141.             $this->comment[] = $comment;
  142.             $comment->setEngagementBudgetEngage($this);
  143.         }
  144.         return $this;
  145.     }
  146.     public function removeComment(EngagementBudgetEngageComment $comment): self
  147.     {
  148.         if ($this->comment->removeElement($comment)) {
  149.             // set the owning side to null (unless already changed)
  150.             if ($comment->getEngagementBudgetEngage() === $this) {
  151.                 $comment->setEngagementBudgetEngage(null);
  152.             }
  153.         }
  154.         return $this;
  155.     }
  156.     public function getFournisseur(): ?Fournisseur
  157.     {
  158.         return $this->fournisseur;
  159.     }
  160.     public function setFournisseur(?Fournisseur $fournisseur): self
  161.     {
  162.         $this->fournisseur = $fournisseur;
  163.         return $this;
  164.     }
  165.     /**
  166.      * @return Collection|EngagementBudgetEngageDetail[]
  167.      */
  168.     public function getEngagementBudgetEngageDetail(): Collection
  169.     {
  170.         return $this->engagementBudgetEngageDetail;
  171.     }
  172.     public function addEngagementBudgetEngageDetail(EngagementBudgetEngageDetail $detail): self
  173.     {
  174.         if (!$this->engagementBudgetEngageDetail->contains($detail)) {
  175.             $this->engagementBudgetEngageDetail[] = $detail;
  176.             $detail->setEngagementBudgetEngage($this);
  177.         }
  178.         return $this;
  179.     }
  180.     public function removeEngagementBudgetEngageDetail(EngagementBudgetEngageDetail $detail): self
  181.     {
  182.         if ($this->engagementBudgetEngageDetail->removeElement($detail)) {
  183.             if ($detail->getEngagementBudgetEngage() === $this) {
  184.                 $detail->setEngagementBudgetEngage(null);
  185.             }
  186.         }
  187.         return $this;
  188.     }
  189. }