<?php
namespace App\Entity;
use App\Repository\StreamingRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
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\Ignore;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Translation\StreamingTranslation;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=StreamingRepository::class)
* @Gedmo\TranslationEntity(class="App\Entity\Translation\StreamingTranslation")
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
* @Vich\Uploadable
*/
class Streaming implements Translatable
{
use TimestampableEntity;
use SetTranslationsTrait;
public const FIELDS = [
'title'
];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups("streaming:list", "streaming:item")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Gedmo\Translatable
* @Groups("streaming:list", "streaming:item")
*/
private $title;
/**
* @var string
* @Ignore()
*/
private $titleEn;
/**
* @var string
* @Ignore()
*/
private $titleCa;
/**
* @ORM\Column(type="string", length=255)
* @Groups("streaming:list", "streaming:item")
*/
private $url;
/**
* @ORM\OneToMany(
* targetEntity="App\Entity\Translation\StreamingTranslation",
* mappedBy="object",
* cascade={"persist", "remove"}
* )
* @Ignore()
*/
private $translations;
/**
* @ORM\Column(type="datetime", nullable=true)
* @var \DateTime|null
*/
protected $deletedAt;
/**
* 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()
{
return $this->deletedAt;
}
/**
* News constructor.
*/
public function __construct()
{
$this->translations = new ArrayCollection();
}
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 mixed
*/
public function getTitleEn()
{
return $this->titleEn;
}
/**
* @param string|null $titleEn
*
* @return $this
*/
public function setTitleEn(?string $titleEn): self
{
$this->titleEn = $titleEn;
return $this;
}
/**
* @return mixed
*/
public function getTitleCa()
{
return $this->titleCa;
}
/**
* @param string|null $titleCa
*
* @return $this
*/
public function setTitleCa(?string $titleCa): self
{
$this->titleCa = $titleCa;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
/**
* @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;
public function setTranslatableLocale($locale)
{
$this->locale = $locale;
}
public function getTranslations()
{
return $this->translations;
}
public function addTranslation(StreamingTranslation $t)
{
if (!$this->translations->contains($t)) {
$this->translations[] = $t;
$t->setObject($this);
}
}
}