<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiFilter;
use App\Entity\Translation\ExperienceTranslation;
use App\Filter\ExperienceEnabledFilter;
use App\Repository\ExperienceRepository;
use DateTime;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Gedmo\Translatable\Translatable;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\Ignore;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=ExperienceRepository::class)
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false,hardDelete=false)
* @Gedmo\TranslationEntity(class="App\Entity\Translation\ExperienceTranslation")
* @Vich\Uploadable
*/
class Experience implements Translatable
{
use TimestampableEntity;
use SetTranslationsTrait;
public const FIELDS = [
'title',
'subTitle',
'popupTitle',
'popupSubTitle',
'buttonName',
'popupButtonName',
'url'
];
public const FIELDS_NO_FALLBACK = [
'url'
];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups("experience:list", "experience:item")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Gedmo\Translatable
* @Groups("experience:list", "experience:item")
*/
private ?string $title;
/**
* @Ignore()
*/
private ?string $titleEn = null;
/**
* @Ignore()
*/
private ?string $titleCa = null;
/**
* @ORM\Column(type="string", length=255)
* @Gedmo\Translatable
* @Groups("experience:list", "experience:item")
*/
private ?string $subTitle;
/**
* @Ignore()
*/
private ?string $subTitleEn = null;
/**
* @Ignore()
*/
private ?string $subTitleCa = null;
/**
* @ORM\Column(type="string", length=255)
* @Gedmo\Translatable
* @Groups("experience:list", "experience:item")
*/
private ?string $popupTitle = null;
/**
* @Ignore()
*/
private ?string $popupTitleEn = null;
/**
* @Ignore()
*/
private ?string $popupTitleCa = null;
/**
* @ORM\Column(type="string", length=255)
* @Gedmo\Translatable
* @Groups("experience:list", "experience:item")
*/
private ?string $popupSubTitle = null;
/**
* @Ignore()
*/
private ?string $popupSubTitleEn = null;
/**
* @Ignore()
*/
private ?string $popupSubTitleCa = null;
/**
* @ORM\Column(type="boolean")
* @Groups("experience:list", "experience:item")
*/
private bool $enabled;
/**
* @var string
* @Groups("experience:list", "experience:item")
*/
private $image;
/**
* @ORM\Column(type="string")
* @Groups("experience:list", "experience:item")
* @var string|null
*
*/
private ?string $imageName = null;
/**
* @ORM\Column(type="integer")
*
* @var int|null
* @Ignore()
*/
private ?int $imageSize;
/**
* @ORM\Column(type="string")
* @Groups("experience:list", "experience:item")
* @var string|null
*
*/
private ?string $imagePopupName = null;
/**
* @ORM\Column(type="integer")
*
* @var int|null
* @Ignore()
*/
private ?int $imagePopupSize;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups("experience:list", "experience:item")
* @Gedmo\Translatable
*/
private ?string $url;
/**
* @var string | null
* @Ignore()
*/
private ?string $urlEn = null;
/**
* @var string | null
* @Ignore()
*/
private ?string $urlCa = null;
/**
* @ORM\OneToMany(
* targetEntity="App\Entity\Translation\ExperienceTranslation",
* mappedBy="object",
* cascade={"persist", "remove"}
* )
* @Ignore()
*/
private $translations;
/**
* @Assert\File(
* mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/jpg"},
* mimeTypesMessage = "Wrong file type (jpeg,gif,png,jpg)"
* )
* @Vich\UploadableField(mapping="experience", fileNameProperty="imageName", size="imageSize")
* @var File|null
* @Ignore()
*/
private ?File $imageFile = null;
/**
* @Assert\File(
* mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/jpg"},
* mimeTypesMessage = "Wrong file type (jpeg,gif,png,jpg)"
* )
* @Vich\UploadableField(mapping="experience", fileNameProperty="imagePopupName", size="imagePopupSize")
* @var File|null
* @Ignore()
*/
private $imagePopupFile;
/**
* @ORM\Column(type="string", nullable=true)
* @Groups("experience:list", "experience:item")
* @var string|null
* @Ignore()
*
*/
private ?string $imageNameEn = null;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @var int|null
* @Ignore()
*/
private ?int $imageSizeEn;
/**
* @Assert\File(
* mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/jpg"},
* mimeTypesMessage = "Wrong file type (jpeg,gif,png,jpg)"
* )
* @Vich\UploadableField(mapping="experience", fileNameProperty="imageNameEn", size="imageSizeEn")
* @var File|null
* @Ignore()
*/
private ?File $imageFileEn = null;
/**
* @ORM\Column(type="string", nullable=true)
* @Groups("experience:list", "experience:item")
* @var string|null
* @Ignore()
*
*/
private ?string $imageNameCa = null;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @var int|null
* @Ignore()
*/
private ?int $imageSizeCa;
/**
* @Assert\File(
* mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/jpg"},
* mimeTypesMessage = "Wrong file type (jpeg,gif,png,jpg)"
* )
* @Vich\UploadableField(mapping="experience", fileNameProperty="imageNameCa", size="imageSizeCa")
* @var File|null
* @Ignore()
*/
private ?File $imageFileCa = null;
/**
* @ORM\Column(type="string", length=100)
* @Gedmo\Translatable
* @Groups("experience:list", "experience:item")
*/
private ?string $buttonName;
/**
* @Ignore()
*/
private ?string $buttonNameEn = null;
/**
* @Ignore()
*/
private ?string $buttonNameCa = null;
/**
* @ORM\Column(type="string", length=100)
* @Gedmo\Translatable
* @Groups("experience:list", "experience:item")
*/
private ?string $popupButtonName;
/**
* @Ignore()
*/
private ?string $popupButtonNameEn = null;
/**
* @Ignore()
*/
private ?string $popupButtonNameCa = null;
/**
* @Gedmo\Locale
* Used locale to override Translation listener`s locale
* this is not a mapped field of entity metadata, just a simple property
*/
private $locale;
/**
* @ORM\Column(type="datetime", nullable=true)
* @var DateTime|null
*/
protected ?DateTime $deletedAt;
public function __construct()
{
$this->image = $this;
$this->enabled = true;
$this->translations = new ArrayCollection();
}
public function __toString(): string
{
return $this->getTitle();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
/**
* @return string | null
*/
public function getTitleEn(): ?string
{
return $this->titleEn;
}
/**
* @param string|null $titleEn
*
* @return $this
*/
public function setTitleEn(?string $titleEn): self
{
$this->titleEn = $titleEn;
return $this;
}
/**
* @return string | null
*/
public function getTitleCa(): ?string
{
return $this->titleCa;
}
/**
* @param string|null $titleCa
*
* @return $this
*/
public function setTitleCa(?string $titleCa): self
{
$this->titleCa = $titleCa;
return $this;
}
public function getSubTitle(): ?string
{
return $this->subTitle;
}
public function setSubTitle(string $subTitle): self
{
$this->subTitle = $subTitle;
return $this;
}
public function getSubTitleEn(): ?string
{
return $this->subTitleEn;
}
public function setSubTitleEn(?string $subTitleEn): self
{
$this->subTitleEn = $subTitleEn;
return $this;
}
public function getSubTitleCa(): ?string
{
return $this->subTitleCa;
}
public function setSubTitleCa(?string $subTitleCa): self
{
$this->subTitleCa = $subTitleCa;
return $this;
}
public function getPopupTitle(): ?string
{
return $this->popupTitle;
}
public function setPopupTitle(string $popupTitle): self
{
$this->popupTitle = $popupTitle;
return $this;
}
public function getPopupTitleEn(): ?string
{
return $this->popupTitleEn;
}
public function setPopupTitleEn(?string $popupTitleEn): self
{
$this->popupTitleEn = $popupTitleEn;
return $this;
}
public function getPopupTitleCa(): ?string
{
return $this->popupTitleCa;
}
public function setPopupTitleCa(?string $popupTitleCa): self
{
$this->popupTitleCa = $popupTitleCa;
return $this;
}
public function getPopupSubTitle(): ?string
{
return $this->popupSubTitle;
}
public function setPopupSubTitle(string $popupSubTitle): self
{
$this->popupSubTitle = $popupSubTitle;
return $this;
}
public function getPopupSubTitleEn(): ?string
{
return $this->popupSubTitleEn;
}
public function setPopupSubTitleEn(?string $popupSubTitleEn): self
{
$this->popupSubTitleEn = $popupSubTitleEn;
return $this;
}
public function getPopupSubTitleCa(): ?string
{
return $this->popupSubTitleCa;
}
public function setPopupSubTitleCa(?string $popupSubTitleCa): self
{
$this->popupSubTitleCa = $popupSubTitleCa;
return $this;
}
public function getEnabled(): ?bool
{
return $this->enabled;
}
public function setEnabled(bool $enabled): self
{
$this->enabled = $enabled;
return $this;
}
/**
* Set or clear the deleted at timestamp.
*
* @return self
*/
public function setDeletedAt(DateTime $deletedAt = null)
{
$this->deletedAt = $deletedAt;
return $this;
}
/**
* Get the deleted at timestamp value. Will return null if
* the entity has not been soft deleted.
*
* @return DateTime|null
*/
public function getDeletedAt(): ?DateTime
{
return $this->deletedAt;
}
public function setTranslatableLocale($locale): void
{
$this->locale = $locale;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
/**
* @param File|null $imageFile
*/
public function setImageFile(?File $imageFile = null): void
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
$this->updatedAt = new DateTimeImmutable();
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageName(?string $imageName): void
{
$this->imageName = $imageName;
}
public function getImageName(): ?string
{
return $this->imageName;
}
public function setImageSize(?int $imageSize): void
{
$this->imageSize = $imageSize;
}
public function getImageSize(): ?int
{
return $this->imageSize;
}
/**
* @param File|null $imagePopupFile
*/
public function setImagePopupFile(?File $imagePopupFile = null): void
{
$this->imagePopupFile = $imagePopupFile;
if (null !== $imagePopupFile) {
$this->updatedAt = new DateTimeImmutable();
}
}
public function getImagePopupFile(): ?File
{
return $this->imagePopupFile;
}
public function setImagePopupName(?string $imagePopupName): void
{
$this->imagePopupName = $imagePopupName;
}
public function getImagePopupName(): ?string
{
return $this->imagePopupName;
}
public function setImagePopupSize(?int $imagePopupSize): void
{
$this->imagePopupSize = $imagePopupSize;
}
public function getImagePopupSize(): ?int
{
return $this->imagePopupSize;
}
public function getTranslations()
{
return $this->translations;
}
public function addTranslation(ExperienceTranslation $t)
{
if (!$this->translations->contains($t)) {
$this->translations[] = $t;
$t->setObject($this);
}
}
/**
* @param File|null $imageFileEn
* @return Experience
*/
public function setImageFileEn(?File $imageFileEn = null): self
{
$this->imageFileEn = $imageFileEn;
if (null !== $imageFileEn) {
$this->updatedAt = new DateTimeImmutable();
}
return $this;
}
public function getImageFileEn(): ?File
{
return $this->imageFileEn;
}
public function setImageNameEn(?string $imageNameEn): self
{
$this->imageNameEn = $imageNameEn;
return $this;
}
public function getImageNameEn(): ?string
{
return $this->imageNameEn;
}
public function setImageSizeEn(?int $imageSizeEn): self
{
$this->imageSizeEn = $imageSizeEn;
return $this;
}
public function getImageSizeEn(): ?int
{
return $this->imageSizeEn;
}
/**
* @param File|null $imageFileCa
* @return Experience
*/
public function setImageFileCa(?File $imageFileCa = null): self
{
$this->imageFileCa = $imageFileCa;
if (null !== $imageFileCa) {
$this->updatedAt = new DateTimeImmutable();
}
return $this;
}
public function getImageFileCa(): ?File
{
return $this->imageFileCa;
}
public function setImageNameCa(?string $imageNameCa): self
{
$this->imageNameCa = $imageNameCa;
return $this;
}
public function getImageNameCa(): ?string
{
return $this->imageNameCa;
}
public function setImageSizeCa(?int $imageSizeCa): self
{
$this->imageSizeCa = $imageSizeCa;
return $this;
}
public function getImageSizeCa(): ?int
{
return $this->imageSizeCa;
}
public function getButtonName(): ?string
{
return $this->buttonName;
}
public function setButtonName(?string $buttonName): self
{
$this->buttonName = $buttonName;
return $this;
}
public function getButtonNameEn(): ?string
{
return $this->buttonNameEn;
}
public function setButtonNameEn(?string $buttonNameEn): self
{
$this->buttonNameEn = $buttonNameEn;
return $this;
}
public function getButtonNameCa(): ?string
{
return $this->buttonNameCa;
}
public function setButtonNameCa(?string $buttonNameCa): self
{
$this->buttonNameCa = $buttonNameCa;
return $this;
}
public function getPopupButtonName(): ?string
{
return $this->popupButtonName;
}
public function setPopupButtonName(?string $popupButtonName): self
{
$this->popupButtonName = $popupButtonName;
return $this;
}
public function getPopupButtonNameEn(): ?string
{
return $this->popupButtonNameEn;
}
public function setPopupButtonNameEn(?string $popupButtonNameEn): self
{
$this->popupButtonNameEn = $popupButtonNameEn;
return $this;
}
public function getPopupButtonNameCa(): ?string
{
return $this->popupButtonNameCa;
}
public function setPopupButtonNameCa(?string $popupButtonNameCa): self
{
$this->popupButtonNameCa = $popupButtonNameCa;
return $this;
}
/**
* @return string | null
*/
public function getUrlEn(): ?string
{
return $this->urlEn;
}
/**
* @param string | null $urlEn
*/
public function setUrlEn(?string $urlEn): void
{
$this->urlEn = $urlEn;
}
/**
* @return string | null
*/
public function getUrlCa(): ?string
{
return $this->urlCa;
}
/**
* @param string | null $urlCa
*/
public function setUrlCa(?string $urlCa): void
{
$this->urlCa = $urlCa;
}
}