src/Entity/Image.php line 64

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Traits\TimeStampTrait;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\ImageRepository;
  6. use Doctrine\ORM\Mapping\ManyToOne;
  7. use Doctrine\ORM\Mapping\JoinColumn;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11.  * @Vich\Uploadable
  12.  * @ORM\Entity(repositoryClass=ImageRepository::class)
  13.  */
  14. class Image
  15. {
  16.     use TimeStampTrait;
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=50, nullable=true)
  25.      */
  26.     private $name;
  27.     /**
  28.      * @ORM\Column(type="string", length=255)
  29.      */
  30.     private $url;
  31.     /**
  32.      * @Vich\UploadableField(mapping="default_img_mapping", fileNameProperty="url")
  33.      * @var File
  34.      */
  35.     private $file;
  36.     /**
  37.      * @ORM\Column(type="string", length=255, nullable=true)
  38.      */
  39.     private $longitude;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      */
  43.     private $latitude;
  44.     /**
  45.      * @ORM\Column(type="string", length=255)
  46.      */
  47.     private $imageType;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=DisturbingIntervention::class, inversedBy="images")
  50.      * @JoinColumn(name="disturbing_intervention_id", referencedColumnName="id")
  51.      */
  52.     private $disturbingIntervention;
  53.     public function __construct($name$url=null$file$latitude$longitude$imageType)
  54.     {
  55.         $this->name $name;
  56.         $this->url $url;
  57.         $this->file $file;
  58.         $this->latitude $latitude;
  59.         $this->longitude $longitude;
  60.         $this->imageType $imageType;
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getName(): ?string
  67.     {
  68.         return $this->name;
  69.     }
  70.     public function setName(?string $name): self
  71.     {
  72.         $this->name $name;
  73.         return $this;
  74.     }
  75.     public function getUrl(): ?string
  76.     {
  77.         return $this->url;
  78.     }
  79.     public function setUrl(string $url): self
  80.     {
  81.         $this->url $url;
  82.         return $this;
  83.     }
  84.     public function getLongitude(): ?string
  85.     {
  86.         return $this->longitude;
  87.     }
  88.     public function setLongitude(?string $longitude): self
  89.     {
  90.         $this->longitude $longitude;
  91.         return $this;
  92.     }
  93.     public function getLatitude(): ?string
  94.     {
  95.         return $this->latitude;
  96.     }
  97.     public function setLatitude(?string $latitude): self
  98.     {
  99.         $this->latitude $latitude;
  100.         return $this;
  101.     }
  102.     public function getFile(): ?File
  103.     {
  104.         return $this->file;
  105.     }
  106.     public function setFile(?File $file null): self
  107.     {
  108.         $this->file $file;
  109.         if ($file) {
  110.             $this->updatedAt = new \DateTimeImmutable();
  111.         }
  112.         return $this;
  113.     }
  114.     public function getImageType(): ?string
  115.     {
  116.         return $this->imageType;
  117.     }
  118.     public function setImageType(string $imageType): self
  119.     {
  120.         $this->imageType $imageType;
  121.         return $this;
  122.     }
  123.     public function getDisturbingIntervention(): ?DisturbingIntervention
  124.     {
  125.         return $this->disturbingIntervention;
  126.     }
  127.     public function setDisturbingIntervention(?DisturbingIntervention $disturbingIntervention): self
  128.     {
  129.         $this->disturbingIntervention $disturbingIntervention;
  130.         return $this;
  131.     }
  132. }