<?php
namespace App\Entity;
use App\Repository\POIContentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\File;
#[ORM\Entity(repositoryClass: POIContentRepository::class)]
#[Vich\Uploadable]
class POIContent
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::ARRAY, nullable: true)]
#[Serializer\Groups(["poi"])]
private array $type = [];
#[ORM\Column(length: 2048, nullable: true)]
#[Serializer\Groups(["poi"])]
private ?string $text = null;
#[ORM\Column(length: 255, nullable: true)]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("audioTextUrl")]
private ?string $audio_text_url = null;
#[ORM\Column(length: 255, nullable: true)]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("videoUrl")]
private ?string $video_url = null;
#[ORM\Column(length: 255, nullable: true)]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("imageUrl")]
private ?string $image_url = null;
#[ORM\Column(length: 255, nullable: true)]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("audioUrl")]
private ?string $audio_url = null;
#[ORM\ManyToMany(targetEntity: POI::class, inversedBy: 'poicontents')]
#[Serializer\Groups(["poi"])]
private Collection $pois;
#[Vich\UploadableField(mapping: 'thumbnails', fileNameProperty: 'image_url')]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("imageFile")]
private ?File $imageFile = null;
#[Vich\UploadableField(mapping: 'thumbnails', fileNameProperty: 'video_url')]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("videoFile")]
private ?File $videoFile = null;
#[Vich\UploadableField(mapping: 'thumbnails', fileNameProperty: 'audio_url')]
#[Serializer\Groups(["poi"])]
#[Serializer\SerializedName("audioFile")]
private ?File $audioFile = null;
public function __construct()
{
$this->pois = new ArrayCollection();
$this->pOIs = new ArrayCollection();
}
public function setImageFile(?File $imageFile = null): void
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
// 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
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setVideoFile(?File $videoFile = null): void
{
$this->videoFile = $videoFile;
if (null !== $videoFile) {
// 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
}
}
public function getVideoFile(): ?File
{
return $this->videoFile;
}
public function getAudioFile(): ?File
{
return $this->audioFile;
}
public function setAudioFile(?File $audioFile = null): void
{
$this->audioFile = $audioFile;
if (null !== $audioFile) {
// 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
}
}
public function getId(): ?int
{
return $this->id;
}
public function getType(): array
{
return $this->type;
}
public function setType(?array $type): self
{
$this->type = $type;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getAudioTextUrl(): ?string
{
return $this->audio_text_url;
}
public function setAudioTextUrl(?string $audio_text_url): self
{
$this->audio_text_url = $audio_text_url;
return $this;
}
public function getVideoUrl(): ?string
{
return $this->video_url;
}
public function setVideoUrl(string $video_url): self
{
$this->video_url = $video_url;
return $this;
}
public function getImageUrl(): ?string
{
return $this->image_url;
}
public function setImageUrl(string $image_url): self
{
$this->image_url = $image_url;
return $this;
}
public function getAudioUrl(): ?string
{
return $this->audio_url;
}
public function setAudioUrl(string $audio_url): self
{
$this->audio_url = $audio_url;
return $this;
}
/**
* @return Collection<int, POI>
*/
public function getPois(): Collection
{
return $this->pois;
}
public function addPoi(POI $poi): self
{
if (!$this->pois->contains($poi)) {
$this->pois->add($poi);
}
return $this;
}
public function removePoi(POI $poi): self
{
$this->pois->removeElement($poi);
return $this;
}
}