641 lines
15 KiB
PHP
641 lines
15 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\DevisRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\HttpFoundation\File\File;
|
|
use Vich\UploaderBundle\Mapping\Attribute\Uploadable;
|
|
use Vich\UploaderBundle\Mapping\Attribute\UploadableField;
|
|
|
|
#[ORM\Entity(repositoryClass: DevisRepository::class)]
|
|
#[Uploadable]
|
|
class Devis
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'devis')]
|
|
private ?Customer $customer = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $num = null;
|
|
|
|
#[ORM\Column]
|
|
private ?\DateTimeImmutable $createA = null;
|
|
|
|
#[ORM\Column]
|
|
private ?\DateTimeImmutable $updateAt = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $state = null;
|
|
|
|
#[UploadableField(mapping: 'devis_file', fileNameProperty: 'devisFileName', size: 'devisFileSize')]
|
|
private ?File $devisFile = null;
|
|
#[ORM\Column(nullable: true)]
|
|
private ?string $devisFileName = null;
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $devisFileSize = null;
|
|
|
|
#[UploadableField(mapping: 'devis_docuseal', fileNameProperty: 'devisDocuSealFileName', size: 'devisDocuSealFileSize')]
|
|
private ?File $devisDocuSealFile = null;
|
|
#[ORM\Column(nullable: true)]
|
|
private ?string $devisDocuSealFileName = null;
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $devisDocuSealFileSize = null;
|
|
|
|
#[UploadableField(mapping: 'devis_signed', fileNameProperty: 'devisSignedFileName', size: 'devisSignedFileSize')]
|
|
private ?File $devisSignFile = null;
|
|
#[ORM\Column(nullable: true)]
|
|
private ?string $devisSignedFileName = null;
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $devisSignedFileSize = null;
|
|
|
|
#[UploadableField(mapping: 'devis_audit', fileNameProperty: 'devisAuditFileName', size: 'devisAuditFileSize')]
|
|
private ?File $devisAuditFile = null;
|
|
#[ORM\Column(nullable: true)]
|
|
private ?string $devisAuditFileName = null;
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $devisAuditFileSize = null;
|
|
|
|
#[ORM\Column(length: 255, nullable: true)]
|
|
private ?string $signatureId = null;
|
|
|
|
#[ORM\OneToMany(targetEntity: DevisLine::class, mappedBy: 'devi')]
|
|
private Collection $devisLines;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'devis')]
|
|
private ?CustomerAddress $addressShip = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'devisBill')]
|
|
private ?CustomerAddress $billAddress = null;
|
|
|
|
#[ORM\OneToOne(mappedBy: 'devis', cascade: ['persist', 'remove'])]
|
|
private ?ProductReserve $productReserve = null;
|
|
|
|
#[ORM\OneToOne(mappedBy: 'devis', cascade: ['persist', 'remove'])]
|
|
private ?Contrats $contrats = null;
|
|
|
|
#[ORM\OneToOne(inversedBy: 'devis', cascade: ['persist', 'remove'])]
|
|
private ?OrderSession $orderSession = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?float $distance = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?float $priceShip = null;
|
|
|
|
#[ORM\Column(length: 255, nullable: true)]
|
|
private ?string $paymentMethod = null;
|
|
|
|
#[ORM\Column]
|
|
private ?\DateTimeImmutable $startAt = null;
|
|
|
|
#[ORM\Column]
|
|
private ?\DateTimeImmutable $endAt = null;
|
|
|
|
#[ORM\Column(options: ['default' => false])]
|
|
private ?bool $isNotAddCaution = false;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'devis')]
|
|
private ?Prestaire $prestataire = null;
|
|
|
|
/**
|
|
* @var Collection<int, DevisOptions>
|
|
*/
|
|
#[ORM\OneToMany(targetEntity: DevisOptions::class, mappedBy: 'devis')]
|
|
private Collection $devisOptions;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->devisLines = new ArrayCollection();
|
|
$this->devisOptions = new ArrayCollection();
|
|
}
|
|
|
|
public function getOrderSession(): ?OrderSession
|
|
{
|
|
return $this->orderSession;
|
|
}
|
|
|
|
public function setOrderSession(?OrderSession $orderSession): static
|
|
{
|
|
$this->orderSession = $orderSession;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDistance(): ?float
|
|
{
|
|
return $this->distance;
|
|
}
|
|
|
|
public function setDistance(?float $distance): static
|
|
{
|
|
$this->distance = $distance;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPriceShip(): ?float
|
|
{
|
|
return $this->priceShip;
|
|
}
|
|
|
|
public function setPriceShip(?float $priceShip): static
|
|
{
|
|
$this->priceShip = $priceShip;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPaymentMethod(): ?string
|
|
{
|
|
return $this->paymentMethod;
|
|
}
|
|
|
|
public function setPaymentMethod(?string $paymentMethod): static
|
|
{
|
|
$this->paymentMethod = $paymentMethod;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function isIsNotAddCaution(): ?bool
|
|
{
|
|
return $this->isNotAddCaution;
|
|
}
|
|
|
|
public function setIsNotAddCaution(bool $isNotAddCaution): static
|
|
{
|
|
$this->isNotAddCaution = $isNotAddCaution;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPrestataire(): ?Prestaire
|
|
{
|
|
return $this->prestataire;
|
|
}
|
|
|
|
public function setPrestataire(?Prestaire $prestataire): static
|
|
{
|
|
$this->prestataire = $prestataire;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getCustomer(): ?Customer
|
|
{
|
|
return $this->customer;
|
|
}
|
|
|
|
public function setCustomer(?Customer $customer): static
|
|
{
|
|
$this->customer = $customer;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getNum(): ?string
|
|
{
|
|
return $this->num;
|
|
}
|
|
|
|
public function setNum(string $num): static
|
|
{
|
|
$this->num = $num;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCreateA(): ?\DateTimeImmutable
|
|
{
|
|
return $this->createA;
|
|
}
|
|
|
|
public function setCreateA(\DateTimeImmutable $createA): static
|
|
{
|
|
$this->createA = $createA;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getUpdateAt(): ?\DateTimeImmutable
|
|
{
|
|
return $this->updateAt;
|
|
}
|
|
|
|
public function setUpdateAt(\DateTimeImmutable $updateAt): static
|
|
{
|
|
$this->updateAt = $updateAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getState(): ?string
|
|
{
|
|
return $this->state;
|
|
}
|
|
|
|
public function setState(string $state): static
|
|
{
|
|
$this->state = $state;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param File|null $devisFile
|
|
*/
|
|
public function setDevisFile(?File $devisFile): void
|
|
{
|
|
$this->devisFile = $devisFile;
|
|
if (null !== $devisFile) {
|
|
// It is required that at least one field changes if you are using doctrine
|
|
// otherwise the event listeners won't be called and the file is lost
|
|
$this->updateAt = new \DateTimeImmutable();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param File|null $devisDocuSealFile
|
|
*/
|
|
public function setDevisDocuSealFile(?File $devisDocuSealFile): void
|
|
{
|
|
$this->devisDocuSealFile = $devisDocuSealFile;
|
|
if (null !== $devisDocuSealFile) {
|
|
// It is required that at least one field changes if you are using doctrine
|
|
// otherwise the event listeners won't be called and the file is lost
|
|
$this->updateAt = new \DateTimeImmutable();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param File|null $devisSignFile
|
|
*/
|
|
public function setDevisSignFile(?File $devisSignFile): void
|
|
{
|
|
$this->devisSignFile = $devisSignFile;
|
|
if (null !== $devisSignFile) {
|
|
// It is required that at least one field changes if you are using doctrine
|
|
// otherwise the event listeners won't be called and the file is lost
|
|
$this->updateAt = new \DateTimeImmutable();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param File|null $devisAuditFile
|
|
*/
|
|
public function setDevisAuditFile(?File $devisAuditFile): void
|
|
{
|
|
$this->devisAuditFile = $devisAuditFile;
|
|
if (null !== $devisAuditFile) {
|
|
// It is required that at least one field changes if you are using doctrine
|
|
// otherwise the event listeners won't be called and the file is lost
|
|
$this->updateAt = new \DateTimeImmutable();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param int|null $devisSignedFileSize
|
|
*/
|
|
public function setDevisSignedFileSize(?int $devisSignedFileSize): void
|
|
{
|
|
$this->devisSignedFileSize = $devisSignedFileSize;
|
|
}
|
|
|
|
/**
|
|
* @param string|null $devisSignedFileName
|
|
*/
|
|
public function setDevisSignedFileName(?string $devisSignedFileName): void
|
|
{
|
|
$this->devisSignedFileName = $devisSignedFileName;
|
|
}
|
|
|
|
/**
|
|
* @param int|null $devisFileSize
|
|
*/
|
|
public function setDevisFileSize(?int $devisFileSize): void
|
|
{
|
|
$this->devisFileSize = $devisFileSize;
|
|
}
|
|
|
|
/**
|
|
* @param int|null $devisDocuSealFileSize
|
|
*/
|
|
public function setDevisDocuSealFileSize(?int $devisDocuSealFileSize): void
|
|
{
|
|
$this->devisDocuSealFileSize = $devisDocuSealFileSize;
|
|
}
|
|
|
|
/**
|
|
* @param string|null $devisDocuSealFileName
|
|
*/
|
|
public function setDevisDocuSealFileName(?string $devisDocuSealFileName): void
|
|
{
|
|
$this->devisDocuSealFileName = $devisDocuSealFileName;
|
|
}
|
|
|
|
/**
|
|
* @param string|null $devisFileName
|
|
*/
|
|
public function setDevisFileName(?string $devisFileName): void
|
|
{
|
|
$this->devisFileName = $devisFileName;
|
|
}
|
|
|
|
/**
|
|
* @param int|null $devisAuditFileSize
|
|
*/
|
|
public function setDevisAuditFileSize(?int $devisAuditFileSize): void
|
|
{
|
|
$this->devisAuditFileSize = $devisAuditFileSize;
|
|
}
|
|
|
|
/**
|
|
* @param string|null $devisAuditFileName
|
|
*/
|
|
public function setDevisAuditFileName(?string $devisAuditFileName): void
|
|
{
|
|
$this->devisAuditFileName = $devisAuditFileName;
|
|
}
|
|
|
|
/**
|
|
* @return File|null
|
|
*/
|
|
public function getDevisAuditFile(): ?File
|
|
{
|
|
return $this->devisAuditFile;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getDevisAuditFileName(): ?string
|
|
{
|
|
return $this->devisAuditFileName;
|
|
}
|
|
|
|
/**
|
|
* @return int|null
|
|
*/
|
|
public function getDevisAuditFileSize(): ?int
|
|
{
|
|
return $this->devisAuditFileSize;
|
|
}
|
|
|
|
/**
|
|
* @return File|null
|
|
*/
|
|
public function getDevisDocuSealFile(): ?File
|
|
{
|
|
return $this->devisDocuSealFile;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getDevisDocuSealFileName(): ?string
|
|
{
|
|
return $this->devisDocuSealFileName;
|
|
}
|
|
|
|
/**
|
|
* @return int|null
|
|
*/
|
|
public function getDevisDocuSealFileSize(): ?int
|
|
{
|
|
return $this->devisDocuSealFileSize;
|
|
}
|
|
|
|
/**
|
|
* @return File|null
|
|
*/
|
|
public function getDevisFile(): ?File
|
|
{
|
|
return $this->devisFile;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getDevisFileName(): ?string
|
|
{
|
|
return $this->devisFileName;
|
|
}
|
|
|
|
/**
|
|
* @return int|null
|
|
*/
|
|
public function getDevisFileSize(): ?int
|
|
{
|
|
return $this->devisFileSize;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getDevisSignedFileName(): ?string
|
|
{
|
|
return $this->devisSignedFileName;
|
|
}
|
|
|
|
/**
|
|
* @return int|null
|
|
*/
|
|
public function getDevisSignedFileSize(): ?int
|
|
{
|
|
return $this->devisSignedFileSize;
|
|
}
|
|
|
|
/**
|
|
* @return File|null
|
|
*/
|
|
public function getDevisSignFile(): ?File
|
|
{
|
|
return $this->devisSignFile;
|
|
}
|
|
|
|
public function getSignatureId(): ?string
|
|
{
|
|
return $this->signatureId;
|
|
}
|
|
|
|
public function setSignatureId(?string $signatureId): static
|
|
{
|
|
$this->signatureId = $signatureId;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, DevisLine>
|
|
*/
|
|
public function getDevisLines(): Collection
|
|
{
|
|
return $this->devisLines;
|
|
}
|
|
|
|
public function addDevisLine(DevisLine $devisLine): static
|
|
{
|
|
if (!$this->devisLines->contains($devisLine)) {
|
|
$this->devisLines->add($devisLine);
|
|
$devisLine->setDevi($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeDevisLine(DevisLine $devisLine): static
|
|
{
|
|
if ($this->devisLines->removeElement($devisLine)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($devisLine->getDevi() === $this) {
|
|
$devisLine->setDevi(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAddressShip(): ?CustomerAddress
|
|
{
|
|
return $this->addressShip;
|
|
}
|
|
|
|
public function setAddressShip(?CustomerAddress $addressShip): static
|
|
{
|
|
$this->addressShip = $addressShip;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getBillAddress(): ?CustomerAddress
|
|
{
|
|
return $this->billAddress;
|
|
}
|
|
|
|
public function setBillAddress(?CustomerAddress $billAddress): static
|
|
{
|
|
$this->billAddress = $billAddress;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getProductReserve(): ?ProductReserve
|
|
{
|
|
return $this->productReserve;
|
|
}
|
|
|
|
public function setProductReserve(?ProductReserve $productReserve): static
|
|
{
|
|
// unset the owning side of the relation if necessary
|
|
if ($productReserve === null && $this->productReserve !== null) {
|
|
$this->productReserve->setDevis(null);
|
|
}
|
|
|
|
// set the owning side of the relation if necessary
|
|
if ($productReserve !== null && $productReserve->getDevis() !== $this) {
|
|
$productReserve->setDevis($this);
|
|
}
|
|
|
|
$this->productReserve = $productReserve;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getContrats(): ?Contrats
|
|
{
|
|
return $this->contrats;
|
|
}
|
|
|
|
public function setContrats(?Contrats $contrats): static
|
|
{
|
|
// unset the owning side of the relation if necessary
|
|
if ($contrats === null && $this->contrats !== null) {
|
|
$this->contrats->setDevis(null);
|
|
}
|
|
|
|
// set the owning side of the relation if necessary
|
|
if ($contrats !== null && $contrats->getDevis() !== $this) {
|
|
$contrats->setDevis($this);
|
|
}
|
|
|
|
$this->contrats = $contrats;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param \DateTimeImmutable|null $startAt
|
|
*/
|
|
public function setStartAt(?\DateTimeImmutable $startAt): void
|
|
{
|
|
$this->startAt = $startAt;
|
|
}
|
|
|
|
/**
|
|
* @return \DateTimeImmutable|null
|
|
*/
|
|
public function getStartAt(): ?\DateTimeImmutable
|
|
{
|
|
return $this->startAt;
|
|
}
|
|
|
|
/**
|
|
* @param \DateTimeImmutable|null $endAt
|
|
*/
|
|
public function setEndAt(?\DateTimeImmutable $endAt): void
|
|
{
|
|
$this->endAt = $endAt;
|
|
}
|
|
|
|
/**
|
|
* @return \DateTimeImmutable|null
|
|
*/
|
|
public function getEndAt(): ?\DateTimeImmutable
|
|
{
|
|
return $this->endAt;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, DevisOptions>
|
|
*/
|
|
public function getDevisOptions(): Collection
|
|
{
|
|
return $this->devisOptions;
|
|
}
|
|
|
|
public function addDevisOption(DevisOptions $devisOption): static
|
|
{
|
|
if (!$this->devisOptions->contains($devisOption)) {
|
|
$this->devisOptions->add($devisOption);
|
|
$devisOption->setDevis($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeDevisOption(DevisOptions $devisOption): static
|
|
{
|
|
if ($this->devisOptions->removeElement($devisOption)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($devisOption->getDevis() === $this) {
|
|
$devisOption->setDevis(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
}
|