src/Entity/CarAttachment.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * CarAttachment
  8.  *
  9.  * @ORM\Table(name="car_attachments", indexes={@ORM\Index(name="car_id", columns={"car_id"})})
  10.  * @ORM\Entity
  11.  * @Vich\Uploadable
  12.  */
  13. class CarAttachment
  14. {
  15.     /**
  16.      * @var int
  17.      *
  18.      * @ORM\Column(name="id", type="integer", nullable=false)
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="IDENTITY")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @Vich\UploadableField(mapping="car_attachments",fileNameProperty="image")
  25.      */
  26.     private $imageFile;
  27.     /**
  28.      * @var string
  29.      *
  30.      * @ORM\Column(type="string", length=250, nullable=true)
  31.      */
  32.     private $image;
  33.     /**
  34.      * @var \DateTime
  35.      *
  36.      * @ORM\Column(name="created", type="datetime", nullable=true)
  37.      */
  38.     private $created;
  39.     /**
  40.      * @var \Cars
  41.      *
  42.      * @ORM\ManyToOne(targetEntity="Cars", inversedBy="attachments")
  43.      * @ORM\JoinColumns({
  44.      *   @ORM\JoinColumn(name="car_id", referencedColumnName="id")
  45.      * })
  46.      */
  47.     private $car;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=AttachmentTags::class)
  50.      */
  51.     private $tag;
  52.     public function __construct()
  53.     {
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getCreated(): ?\DateTimeInterface
  60.     {
  61.         return $this->created;
  62.     }
  63.     public function setCreated(\DateTimeInterface $created): self
  64.     {
  65.         $this->created = $created;
  66.         return $this;
  67.     }
  68.     public function getCar(): ?Cars
  69.     {
  70.         return $this->car;
  71.     }
  72.     public function setCar(?Cars $car): self
  73.     {
  74.         $this->car = $car;
  75.         return $this;
  76.     }
  77.     /**
  78.      * @return mixed
  79.      */
  80.     public function getImageFile()
  81.     {
  82.         return $this->imageFile;
  83.     }
  84.     /**
  85.      * @param mixed $imageFile
  86.      */
  87.     public function setImageFile(File $imageFile)
  88.     {
  89.         $this->imageFile = $imageFile;
  90.         return $this;
  91.     }
  92.     public function getImage(): ?string
  93.     {
  94.         return $this->image;
  95.     }
  96.     public function setImage(?string $image): self
  97.     {
  98.         $this->image = $image;
  99.         return $this;
  100.     }
  101.     public function __toString()
  102.     {
  103.         return $this->image??"";
  104.     }
  105.     public function getTag(): ?AttachmentTags
  106.     {
  107.         return $this->tag;
  108.     }
  109.     public function setTag(?AttachmentTags $tag): self
  110.     {
  111.         $this->tag = $tag;
  112.         return $this;
  113.     }
  114. }