src/Entity/Installation.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InstallationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=InstallationRepository::class)
  11.  */
  12. class Installation
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @Groups({"fluid_edit"})
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="date_immutable")
  23.      * @Groups({"installation_edit"})
  24.      * @Assert\NotBlank(message="Une date doit être sélectionnée.")
  25.      */
  26.     private $date;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      * @Groups({"installation_edit"})
  30.      */
  31.     private $groupeCover;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      * @Groups({"installation_edit"})
  35.      */
  36.     private $status;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      * @Groups({"installation_edit"})
  40.      */
  41.     private $materialOrder;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      * @Groups({"installation_edit"})
  45.      */
  46.     private $overseen;
  47.     /**
  48.      * @ORM\Column(type="boolean", nullable=true)
  49.      * @Groups({"installation_edit"})
  50.      */
  51.     private $certificate;
  52.     /**
  53.      * @ORM\Column(type="date_immutable", nullable=true)
  54.      * @Groups({"installation_edit"})
  55.      */
  56.     private $certificateDate;
  57.     /**
  58.      * @ORM\Column(type="boolean", nullable=true)
  59.      * @Groups({"installation_edit"})
  60.      */
  61.     private $gas;
  62.     /**
  63.      * @ORM\Column(type="boolean", nullable=true)
  64.      * @Groups({"installation_edit"})
  65.      */
  66.     private $payment;
  67.     /**
  68.      * @ORM\Column(type="date_immutable", nullable=true)
  69.      * @Groups({"installation_edit"})
  70.      */
  71.     private $invoiceDate;
  72.     /**
  73.      * @ORM\Column(type="string", length=255, nullable=true)
  74.      * @Groups({"installation_edit"})
  75.      */
  76.     private $note;
  77.     /**
  78.      * @ORM\ManyToMany(targetEntity=Technician::class, inversedBy="installations")
  79.      * @Assert\Count(min=1, minMessage="Au moins un technicien doit être sélectionné.")
  80.      * @Groups({"installation_edit"})
  81.      * @Assert\NotBlank
  82.      */
  83.     private $technicians;
  84.     /**
  85.      * @ORM\Column(type="string", length=255, nullable=true)
  86.      * @Groups({"installation_edit"})
  87.      * @Assert\NotBlank
  88.      */
  89.     private $localisation;
  90.     /**
  91.      * @ORM\Column(type="string", length=255, nullable=true)
  92.      * @Groups({"installation_edit"})
  93.      */
  94.     private $dossierStatus;
  95.     /**
  96.      * @ORM\Column(type="string", length=255, nullable=true)
  97.      * @Groups({"installation_edit", "fluid_edit"})
  98.      * @Assert\NotBlank
  99.      */
  100.     private $customer;
  101.     /**
  102.      * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="installation",cascade={"persist"})
  103.      * @Groups({"installation_edit"})
  104.      */
  105.     private $products;
  106.     /**
  107.      * @ORM\Column(type="string", length=255, nullable=true)
  108.      */
  109.     private $gasDatasheetNumber;
  110.     /**
  111.      * @ORM\Column(type="string", length=255, nullable=true)
  112.      */
  113.     private $gasDatasheetLink;
  114.     /**
  115.      * @ORM\OneToOne(targetEntity=Fluid::class, mappedBy="installation")
  116.      */
  117.     private $fluid;
  118.     public function __construct()
  119.     {
  120.         $this->technicians = new ArrayCollection();
  121.         $this->products = new ArrayCollection();
  122.     }
  123.     public function __toString(): string
  124.     {
  125.         return $this->customer;
  126.     }
  127.     public function getId(): ?int
  128.     {
  129.         return $this->id;
  130.     }
  131.     public function getDate(): ?\DateTimeImmutable
  132.     {
  133.         return $this->date;
  134.     }
  135.     public function setDate(\DateTimeImmutable $date): self
  136.     {
  137.         $this->date $date;
  138.         return $this;
  139.     }
  140.     public function getCustomer(): ?string
  141.     {
  142.         return $this->customer;
  143.     }
  144.     public function setCustomer(?string $customer): self
  145.     {
  146.         $this->customer $customer;
  147.         return $this;
  148.     }
  149.     public function getGroupeCover(): ?string
  150.     {
  151.         return $this->groupeCover;
  152.     }
  153.     public function setGroupeCover(?string $groupeCover): self
  154.     {
  155.         $this->groupeCover $groupeCover;
  156.         return $this;
  157.     }
  158.     public function getStatus(): ?string
  159.     {
  160.         return $this->status;
  161.     }
  162.     public function setStatus(?string $status): self
  163.     {
  164.         $this->status $status;
  165.         return $this;
  166.     }
  167.     public function getMaterialOrder(): ?string
  168.     {
  169.         return $this->materialOrder;
  170.     }
  171.     public function setMaterialOrder(?string $materialOrder): self
  172.     {
  173.         $this->materialOrder $materialOrder;
  174.         return $this;
  175.     }
  176.     public function getOverseen(): ?string
  177.     {
  178.         return $this->overseen;
  179.     }
  180.     public function setOverseen(?string $overseen): self
  181.     {
  182.         $this->overseen $overseen;
  183.         return $this;
  184.     }
  185.     public function isCertificate(): ?bool
  186.     {
  187.         return $this->certificate;
  188.     }
  189.     public function setCertificate(?bool $certificate): self
  190.     {
  191.         $this->certificate $certificate;
  192.         return $this;
  193.     }
  194.     public function getCertificateDate(): ?\DateTimeImmutable
  195.     {
  196.         return $this->certificateDate;
  197.     }
  198.     public function setCertificateDate(?\DateTimeImmutable $certificateDate): self
  199.     {
  200.         $this->certificateDate $certificateDate;
  201.         return $this;
  202.     }
  203.     public function isGas(): ?bool
  204.     {
  205.         return $this->gas;
  206.     }
  207.     public function setGas(?bool $gas): self
  208.     {
  209.         $this->gas $gas;
  210.         return $this;
  211.     }
  212.     public function isPayment(): ?bool
  213.     {
  214.         return $this->payment;
  215.     }
  216.     public function setPayment(?bool $payment): self
  217.     {
  218.         $this->payment $payment;
  219.         return $this;
  220.     }
  221.     public function getInvoiceDate(): ?\DateTimeImmutable
  222.     {
  223.         return $this->invoiceDate;
  224.     }
  225.     public function setInvoiceDate(?\DateTimeImmutable $invoiceDate): self
  226.     {
  227.         $this->invoiceDate $invoiceDate;
  228.         return $this;
  229.     }
  230.     public function getNote(): ?string
  231.     {
  232.         return $this->note;
  233.     }
  234.     public function setNote(?string $note): self
  235.     {
  236.         $this->note $note;
  237.         return $this;
  238.     }
  239.     /**
  240.      * @return Collection<int, Technician>
  241.      */
  242.     public function getTechnicians(): Collection
  243.     {
  244.         return $this->technicians;
  245.     }
  246.     public function addTechnician(Technician $technician): self
  247.     {
  248.         if (!$this->technicians->contains($technician)) {
  249.             $this->technicians[] = $technician;
  250.         }
  251.         return $this;
  252.     }
  253.     public function removeTechnician(Technician $technician): self
  254.     {
  255.         $this->technicians->removeElement($technician);
  256.         return $this;
  257.     }
  258.     public function getLocalisation(): ?string
  259.     {
  260.         return $this->localisation;
  261.     }
  262.     public function setLocalisation(?string $localisation): self
  263.     {
  264.         $this->localisation $localisation;
  265.         return $this;
  266.     }
  267.     public function getDossierStatus(): ?string
  268.     {
  269.         return $this->dossierStatus;
  270.     }
  271.     public function setDossierStatus(?string $dossierStatus): self
  272.     {
  273.         $this->dossierStatus $dossierStatus;
  274.         return $this;
  275.     }
  276.     /**
  277.      * @return Collection<int, Stock>
  278.      */
  279.     public function getProducts(): Collection
  280.     {
  281.         return $this->products;
  282.     }
  283.     public function addProduct(Stock $product): self
  284.     {
  285.         if (!$this->products->contains($product)) {
  286.             $this->products[] = $product;
  287.             $product->setInstallation($this);
  288.         }
  289.         return $this;
  290.     }
  291.     public function removeProduct(Stock $product): self
  292.     {
  293.         if ($this->products->removeElement($product)) {
  294.             // set the owning side to null (unless already changed)
  295.             if ($product->getInstallation() === $this) {
  296.                 $product->setInstallation(null);
  297.             }
  298.         }
  299.         return $this;
  300.     }
  301.     public function getGasDatasheetNumber(): ?string
  302.     {
  303.         return $this->gasDatasheetNumber;
  304.     }
  305.     public function setGasDatasheetNumber(?string $gasDatasheetNumber): self
  306.     {
  307.         $this->gasDatasheetNumber $gasDatasheetNumber;
  308.         return $this;
  309.     }
  310.     public function getGasDatasheetLink(): ?string
  311.     {
  312.         return $this->gasDatasheetLink;
  313.     }
  314.     public function setGasDatasheetLink(?string $gasDatasheetLink): self
  315.     {
  316.         $this->gasDatasheetLink $gasDatasheetLink;
  317.         return $this;
  318.     }
  319.     public function getFluid(): ?Fluid
  320.     {
  321.         return $this->fluid;
  322.     }
  323.     public function setFluid(?Fluid $fluid): self
  324.     {
  325.         // unset the owning side of the relation if necessary
  326.         if ($fluid === null && $this->fluid !== null) {
  327.             $this->fluid->setInstallation(null);
  328.         }
  329.         // set the owning side of the relation if necessary
  330.         if ($fluid !== null && $fluid->getInstallation() !== $this) {
  331.             $fluid->setInstallation($this);
  332.         }
  333.         $this->fluid $fluid;
  334.         return $this;
  335.     }
  336. }