src/Entity/Devis.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Entity\Traits\EntityTrait;
  5. use App\Repository\DevisRepository;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. /**
  8.  * @Vich\Uploadable
  9.  * @ORM\Entity(repositoryClass=DevisRepository::class)
  10.  */
  11. class Devis
  12. {
  13.     use EntityTrait {
  14.         EntityTrait::__construct as private __entityConstruct;
  15.     }
  16.     /**
  17.      * @ORM\Column(type="float", nullable=true)
  18.      */
  19.     private $price;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private $devis;
  24.     /**
  25.      * @Vich\UploadableField(mapping="devis", fileNameProperty="devis")
  26.      * @var File
  27.      */
  28.     private $devisFile;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      */
  32.     private $name;
  33.     /**
  34.      * @ORM\ManyToOne(targetEntity=Chantier::class, inversedBy="devis_chantier")
  35.      * @ORM\JoinColumn(nullable=false)
  36.      */
  37.     private $chantier;
  38.     public function __toString()
  39.     {
  40.         return $this->getName();
  41.     }
  42.     public function getPrice(): ?float
  43.     {
  44.         return $this->price;
  45.     }
  46.     public function setPrice(?float $price): self
  47.     {
  48.         $this->price $price;
  49.         return $this;
  50.     }
  51.     public function getDevis(): ?string
  52.     {
  53.         return $this->devis;
  54.     }
  55.     public function setDevis(?string $devis): self
  56.     {
  57.         $this->devis $devis;
  58.         return $this;
  59.     }
  60.     /**
  61.      * @return File
  62.      */
  63.     public function getDevisFile()
  64.     {
  65.         return $this->devisFile;
  66.     }
  67.     /**
  68.      * @param File $devisFile
  69.      * @throws \Exception
  70.      */
  71.     public function setDevisFile($devisFile)
  72.     {
  73.         $this->devisFile $devisFile;
  74.         if ($devisFile) {
  75.             $this->setUpdatedAt(new \DateTime('now'));
  76.         }
  77.     }
  78.     public function getName(): ?string
  79.     {
  80.         return $this->name;
  81.     }
  82.     public function setName(string $name): self
  83.     {
  84.         $this->name $name;
  85.         return $this;
  86.     }
  87.     public function getChantier(): ?Chantier
  88.     {
  89.         return $this->chantier;
  90.     }
  91.     public function setChantier(?Chantier $chantier): self
  92.     {
  93.         $this->chantier $chantier;
  94.         return $this;
  95.     }
  96. }