src/Entity/Engagement/EngagementBudget.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Engagement;
  3. use App\Entity\BonDeCommande;
  4. use App\Entity\DocUpload;
  5. use App\Repository\EngagementBudgetRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use App\Annotation\CustomAnnotation;
  10. /**
  11.  * @ORM\Entity(repositoryClass=EngagementBudgetRepository::class)
  12.  */
  13. class EngagementBudget
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity="EngagementVersion", cascade={"persist"}, inversedBy="engagementBudget")
  23.      * @ORM\JoinColumn(name="engagement_version_id", referencedColumnName="id",nullable=true)
  24.      */
  25.     private $engagementVersion;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity="EngagementBudgetEngage", cascade={"persist"})
  28.      * @ORM\JoinColumn(name="engagement_budget_engage_id", referencedColumnName="id",nullable=true)
  29.      */
  30.     private $engagementBudgetEngage;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity="EngagementBudgetPrevisionel", cascade={"persist"})
  33.      * @ORM\JoinColumn(name="engagement_budget_previsionel_id", referencedColumnName="id",nullable=true)
  34.      */
  35.     private $engagementBudgetPrevisionel;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity="EngagementBudgetEngageDetail", cascade={"persist"})
  38.      * @ORM\JoinColumn(name="engagement_budget_engage_detail_id", referencedColumnName="id",nullable=true)
  39.      */
  40.     private $engagementBudgetEngageDetail;
  41.     /**
  42.      * Détails d'engagé rattachés à cette ligne budget (un par engagé) — permet plusieurs engagés
  43.      * sur une même dépense.
  44.      * @ORM\OneToMany(targetEntity="EngagementBudgetEngageDetail", mappedBy="engagementBudget")
  45.      */
  46.     private $engagementBudgetEngageDetails;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      */
  50.     private $classificationErp;
  51.     /**
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      */
  54.     private $classificationBudget;
  55.     /**
  56.      * Référentiel hiérarchique du type de dépense (ligne de niveau 3).
  57.      * @ORM\ManyToOne(targetEntity="TypeDepense")
  58.      * @ORM\JoinColumn(name="type_depense_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  59.      * @CustomAnnotation("Type de dépense")
  60.      */
  61.     private $typeDepense;
  62.     /**
  63.      * @ORM\Column(type="float", nullable=true)
  64.      * @CustomAnnotation("Budget prévisionnel")
  65.      */
  66.     private $provisonnelMontant;
  67.     /**
  68.      * @ORM\Column(type="float", nullable=true)
  69.      * @CustomAnnotation("Budget facturé")
  70.      */
  71.     private $factureMontant;
  72.     /**
  73.      * @ORM\Column(type="string", length=255, nullable=true)
  74.      */
  75.     private $categorie;
  76.     /**
  77.      * @ORM\Column(type="datetime", nullable=true)
  78.      */
  79.     private $createdAt;
  80.     /**
  81.      * @ORM\Column(type="text", nullable=true)
  82.      */
  83.     private $token;
  84.     public function __construct()
  85.     {
  86.         $this->createdAt = new \DateTime();
  87.         $this->token =  md5(uniqid());
  88.         $this->engagementBudgetEngageDetails = new ArrayCollection();
  89.     }
  90.     /**
  91.      * @return Collection|EngagementBudgetEngageDetail[]
  92.      */
  93.     public function getEngagementBudgetEngageDetails(): Collection
  94.     {
  95.         return $this->engagementBudgetEngageDetails;
  96.     }
  97.     public function addEngagementBudgetEngageDetail(EngagementBudgetEngageDetail $detail): self
  98.     {
  99.         if (!$this->engagementBudgetEngageDetails->contains($detail)) {
  100.             $this->engagementBudgetEngageDetails[] = $detail;
  101.             $detail->setEngagementBudget($this);
  102.         }
  103.         return $this;
  104.     }
  105.     public function removeEngagementBudgetEngageDetail(EngagementBudgetEngageDetail $detail): self
  106.     {
  107.         if ($this->engagementBudgetEngageDetails->removeElement($detail)) {
  108.             if ($detail->getEngagementBudget() === $this) {
  109.                 $detail->setEngagementBudget(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114.     public function getId(): ?int
  115.     {
  116.         return $this->id;
  117.     }
  118.     public function getClassificationErp(): ?string
  119.     {
  120.         return $this->classificationErp;
  121.     }
  122.     public function setClassificationErp(?string $classificationErp): self
  123.     {
  124.         $this->classificationErp = $classificationErp;
  125.         return $this;
  126.     }
  127.     public function getClassificationBudget(): ?string
  128.     {
  129.         return $this->classificationBudget;
  130.     }
  131.     public function setClassificationBudget(?string $classificationBudget): self
  132.     {
  133.         $this->classificationBudget = $classificationBudget;
  134.         return $this;
  135.     }
  136.     public function getProvisonnelMontant(): ?float
  137.     {
  138.         return $this->provisonnelMontant;
  139.     }
  140.     public function setProvisonnelMontant(?float $provisonnelMontant): self
  141.     {
  142.         $this->provisonnelMontant = $provisonnelMontant;
  143.         return $this;
  144.     }
  145.     public function getEngageMontant(): ?float
  146.     {
  147.         return $this->engageMontant;
  148.     }
  149.     public function setEngageMontant(?float $engageMontant): self
  150.     {
  151.         $this->engageMontant = $engageMontant;
  152.         return $this;
  153.     }
  154.     public function getFactureMontant(): ?float
  155.     {
  156.         return $this->factureMontant;
  157.     }
  158.     public function setFactureMontant(?float $factureMontant): self
  159.     {
  160.         $this->factureMontant = $factureMontant;
  161.         return $this;
  162.     }
  163.     public function getCategorie(): ?string
  164.     {
  165.         return $this->categorie;
  166.     }
  167.     public function setCategorie(?string $categorie): self
  168.     {
  169.         $this->categorie = $categorie;
  170.         return $this;
  171.     }
  172.     public function getCreatedAt(): ?\DateTimeInterface
  173.     {
  174.         return $this->createdAt;
  175.     }
  176.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  177.     {
  178.         $this->createdAt = $createdAt;
  179.         return $this;
  180.     }
  181.     public function getToken(): ?string
  182.     {
  183.         return $this->token;
  184.     }
  185.     public function setToken(?string $token): self
  186.     {
  187.         $this->token = $token;
  188.         return $this;
  189.     }
  190.     public function getComment(): ?string
  191.     {
  192.         return $this->comment;
  193.     }
  194.     public function setComment(?string $comment): self
  195.     {
  196.         $this->comment = $comment;
  197.         return $this;
  198.     }
  199.     public function getEngagementVersion(): ?EngagementVersion
  200.     {
  201.         return $this->engagementVersion;
  202.     }
  203.     public function setEngagementVersion(?EngagementVersion $engagementVersion): self
  204.     {
  205.         $this->engagementVersion = $engagementVersion;
  206.         return $this;
  207.     }
  208.     public function getDevis(): ?DocUpload
  209.     {
  210.         return $this->devis;
  211.     }
  212.     public function setDevis(?DocUpload $devis): self
  213.     {
  214.         $this->devis = $devis;
  215.         return $this;
  216.     }
  217.     public function getBonDeCommande(): ?BonDeCommande
  218.     {
  219.         return $this->bonDeCommande;
  220.     }
  221.     public function setBonDeCommande(?BonDeCommande $bonDeCommande): self
  222.     {
  223.         $this->bonDeCommande = $bonDeCommande;
  224.         return $this;
  225.     }
  226.     public function getEngagementBudgetEngage(): ?EngagementBudgetEngage
  227.     {
  228.         return $this->engagementBudgetEngage;
  229.     }
  230.     public function setEngagementBudgetEngage(?EngagementBudgetEngage $engagementBudgetEngage): self
  231.     {
  232.         $this->engagementBudgetEngage = $engagementBudgetEngage;
  233.         return $this;
  234.     }
  235.     public function getTypeDepense(): ?TypeDepense
  236.     {
  237.         return $this->typeDepense;
  238.     }
  239.     public function setTypeDepense(?TypeDepense $typeDepense): self
  240.     {
  241.         $this->typeDepense = $typeDepense;
  242.         return $this;
  243.     }
  244.     public function getEngagementBudgetEngageDetail(): ?EngagementBudgetEngageDetail
  245.     {
  246.         return $this->engagementBudgetEngageDetail;
  247.     }
  248.     public function setEngagementBudgetEngageDetail(?EngagementBudgetEngageDetail $engagementBudgetEngageDetail): self
  249.     {
  250.         $this->engagementBudgetEngageDetail = $engagementBudgetEngageDetail;
  251.         return $this;
  252.     }
  253.     public function getEngagementBudgetPrevisionel(): ?EngagementBudgetPrevisionel
  254.     {
  255.         return $this->engagementBudgetPrevisionel;
  256.     }
  257.     public function setEngagementBudgetPrevisionel(?EngagementBudgetPrevisionel $engagementBudgetPrevisionel): self
  258.     {
  259.         $this->engagementBudgetPrevisionel = $engagementBudgetPrevisionel;
  260.         return $this;
  261.     }
  262. }