<?php
namespace App\Entity;
use App\Repository\InstallationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=InstallationRepository::class)
*/
class Installation
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @Groups({"fluid_edit"})
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="date_immutable")
* @Groups({"installation_edit"})
* @Assert\NotBlank(message="Une date doit être sélectionnée.")
*/
private $date;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"installation_edit"})
*/
private $groupeCover;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"installation_edit"})
*/
private $status;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"installation_edit"})
*/
private $materialOrder;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"installation_edit"})
*/
private $overseen;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"installation_edit"})
*/
private $certificate;
/**
* @ORM\Column(type="date_immutable", nullable=true)
* @Groups({"installation_edit"})
*/
private $certificateDate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"installation_edit"})
*/
private $gas;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Groups({"installation_edit"})
*/
private $payment;
/**
* @ORM\Column(type="date_immutable", nullable=true)
* @Groups({"installation_edit"})
*/
private $invoiceDate;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"installation_edit"})
*/
private $note;
/**
* @ORM\ManyToMany(targetEntity=Technician::class, inversedBy="installations")
* @Assert\Count(min=1, minMessage="Au moins un technicien doit être sélectionné.")
* @Groups({"installation_edit"})
* @Assert\NotBlank
*/
private $technicians;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"installation_edit"})
* @Assert\NotBlank
*/
private $localisation;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"installation_edit"})
*/
private $dossierStatus;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"installation_edit", "fluid_edit"})
* @Assert\NotBlank
*/
private $customer;
/**
* @ORM\OneToMany(targetEntity=Stock::class, mappedBy="installation",cascade={"persist"})
* @Groups({"installation_edit"})
*/
private $products;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $gasDatasheetNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $gasDatasheetLink;
/**
* @ORM\OneToOne(targetEntity=Fluid::class, mappedBy="installation")
*/
private $fluid;
public function __construct()
{
$this->technicians = new ArrayCollection();
$this->products = new ArrayCollection();
}
public function __toString(): string
{
return $this->customer;
}
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTimeImmutable
{
return $this->date;
}
public function setDate(\DateTimeImmutable $date): self
{
$this->date = $date;
return $this;
}
public function getCustomer(): ?string
{
return $this->customer;
}
public function setCustomer(?string $customer): self
{
$this->customer = $customer;
return $this;
}
public function getGroupeCover(): ?string
{
return $this->groupeCover;
}
public function setGroupeCover(?string $groupeCover): self
{
$this->groupeCover = $groupeCover;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getMaterialOrder(): ?string
{
return $this->materialOrder;
}
public function setMaterialOrder(?string $materialOrder): self
{
$this->materialOrder = $materialOrder;
return $this;
}
public function getOverseen(): ?string
{
return $this->overseen;
}
public function setOverseen(?string $overseen): self
{
$this->overseen = $overseen;
return $this;
}
public function isCertificate(): ?bool
{
return $this->certificate;
}
public function setCertificate(?bool $certificate): self
{
$this->certificate = $certificate;
return $this;
}
public function getCertificateDate(): ?\DateTimeImmutable
{
return $this->certificateDate;
}
public function setCertificateDate(?\DateTimeImmutable $certificateDate): self
{
$this->certificateDate = $certificateDate;
return $this;
}
public function isGas(): ?bool
{
return $this->gas;
}
public function setGas(?bool $gas): self
{
$this->gas = $gas;
return $this;
}
public function isPayment(): ?bool
{
return $this->payment;
}
public function setPayment(?bool $payment): self
{
$this->payment = $payment;
return $this;
}
public function getInvoiceDate(): ?\DateTimeImmutable
{
return $this->invoiceDate;
}
public function setInvoiceDate(?\DateTimeImmutable $invoiceDate): self
{
$this->invoiceDate = $invoiceDate;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
/**
* @return Collection<int, Technician>
*/
public function getTechnicians(): Collection
{
return $this->technicians;
}
public function addTechnician(Technician $technician): self
{
if (!$this->technicians->contains($technician)) {
$this->technicians[] = $technician;
}
return $this;
}
public function removeTechnician(Technician $technician): self
{
$this->technicians->removeElement($technician);
return $this;
}
public function getLocalisation(): ?string
{
return $this->localisation;
}
public function setLocalisation(?string $localisation): self
{
$this->localisation = $localisation;
return $this;
}
public function getDossierStatus(): ?string
{
return $this->dossierStatus;
}
public function setDossierStatus(?string $dossierStatus): self
{
$this->dossierStatus = $dossierStatus;
return $this;
}
/**
* @return Collection<int, Stock>
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(Stock $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setInstallation($this);
}
return $this;
}
public function removeProduct(Stock $product): self
{
if ($this->products->removeElement($product)) {
// set the owning side to null (unless already changed)
if ($product->getInstallation() === $this) {
$product->setInstallation(null);
}
}
return $this;
}
public function getGasDatasheetNumber(): ?string
{
return $this->gasDatasheetNumber;
}
public function setGasDatasheetNumber(?string $gasDatasheetNumber): self
{
$this->gasDatasheetNumber = $gasDatasheetNumber;
return $this;
}
public function getGasDatasheetLink(): ?string
{
return $this->gasDatasheetLink;
}
public function setGasDatasheetLink(?string $gasDatasheetLink): self
{
$this->gasDatasheetLink = $gasDatasheetLink;
return $this;
}
public function getFluid(): ?Fluid
{
return $this->fluid;
}
public function setFluid(?Fluid $fluid): self
{
// unset the owning side of the relation if necessary
if ($fluid === null && $this->fluid !== null) {
$this->fluid->setInstallation(null);
}
// set the owning side of the relation if necessary
if ($fluid !== null && $fluid->getInstallation() !== $this) {
$fluid->setInstallation($this);
}
$this->fluid = $fluid;
return $this;
}
}