<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Traits\EntityTrait;
use App\Repository\DevisRepository;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @Vich\Uploadable
* @ORM\Entity(repositoryClass=DevisRepository::class)
*/
class Devis
{
use EntityTrait {
EntityTrait::__construct as private __entityConstruct;
}
/**
* @ORM\Column(type="float", nullable=true)
*/
private $price;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $devis;
/**
* @Vich\UploadableField(mapping="devis", fileNameProperty="devis")
* @var File
*/
private $devisFile;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity=Chantier::class, inversedBy="devis_chantier")
* @ORM\JoinColumn(nullable=false)
*/
private $chantier;
public function __toString()
{
return $this->getName();
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): self
{
$this->price = $price;
return $this;
}
public function getDevis(): ?string
{
return $this->devis;
}
public function setDevis(?string $devis): self
{
$this->devis = $devis;
return $this;
}
/**
* @return File
*/
public function getDevisFile()
{
return $this->devisFile;
}
/**
* @param File $devisFile
* @throws \Exception
*/
public function setDevisFile($devisFile)
{
$this->devisFile = $devisFile;
if ($devisFile) {
$this->setUpdatedAt(new \DateTime('now'));
}
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getChantier(): ?Chantier
{
return $this->chantier;
}
public function setChantier(?Chantier $chantier): self
{
$this->chantier = $chantier;
return $this;
}
}