<?php
namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity(repositoryClass: 'App\Repository\VideoTutorialRepository')]
#[ORM\Table(name: 'video_tutorial')]
#[Vich\Uploadable]
class VideoTutorial
{
#[ORM\Column(type: 'boolean')]
private bool $isDeleted = false;
#[ORM\Column(type: 'datetime')]
private DateTime $createdAt;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $title = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $description = null;
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Id]
private int $id;
#[Vich\UploadableField(
mapping: 'videoTutorial',
fileNameProperty: 'videoTutorialFileName',
size: 'videoTutorialFileSize',
mimeType: 'video/mp4'
)]
private ?File $videoTutorialFile = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $videoTutorialFileName = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $videoTutorialFileSize = null;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?DateTime $videoTutorialFileUpdatedAt = null;
public function __construct() {
$this->createdAt = new \DateTime();
}
public function __toString() {
return "#" . $this->id . " - " . $this->title;
}
public function getVideoTutorialFile() {
return $this->videoTutorialFile;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
*/
public function setVideoTutorialFile(File $image = null) {
$this->videoTutorialFile = $image;
if (null !== $image) {
// 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
$this->videoTutorialFileUpdatedAt = new \DateTime();
}
}
/**
* Get id
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt() {
return $this->createdAt;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return VideoTutorial
*/
public function setCreatedAt($createdAt) {
$this->createdAt = $createdAt;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle() {
return $this->title;
}
/**
* Set title
*
* @param string $title
*
* @return VideoTutorial
*/
public function setTitle($title) {
$this->title = $title;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription() {
return $this->description;
}
/**
* Set description
*
* @param string $description
*
* @return VideoTutorial
*/
public function setDescription($description) {
$this->description = $description;
return $this;
}
/**
* Set tutorialVideoFileName
*
* @param string $tutorialVideoFileName
*
* @return VideoTutorial
*/
public function setTutorialVideoFileName($tutorialVideoFileName) {
$this->tutorialVideoFileName = $tutorialVideoFileName;
return $this;
}
/**
* Get tutorialVideoFileName
*
* @return string
*/
public function getTutorialVideoFileName() {
return $this->tutorialVideoFileName;
}
/**
* Set tutorialVideoFileSize
*
* @param integer $tutorialVideoFileSize
*
* @return VideoTutorial
*/
public function setTutorialVideoFileSize($tutorialVideoFileSize) {
$this->tutorialVideoFileSize = $tutorialVideoFileSize;
return $this;
}
/**
* Get tutorialVideoFileSize
*
* @return integer
*/
public function getTutorialVideoFileSize() {
return $this->tutorialVideoFileSize;
}
/**
* Set tutorialVideoFileUpdatedAt
*
* @param \DateTime $tutorialVideoFileUpdatedAt
*
* @return VideoTutorial
*/
public function setTutorialVideoFileUpdatedAt($tutorialVideoFileUpdatedAt) {
$this->tutorialVideoFileUpdatedAt = $tutorialVideoFileUpdatedAt;
return $this;
}
/**
* Get tutorialVideoFileUpdatedAt
*
* @return \DateTime
*/
public function getTutorialVideoFileUpdatedAt() {
return $this->tutorialVideoFileUpdatedAt;
}
/**
* Get videoTutorialFileName
*
* @return string
*/
public function getVideoTutorialFileName() {
return $this->videoTutorialFileName;
}
/**
* Set videoTutorialFileName
*
* @param string $videoTutorialFileName
*
* @return VideoTutorial
*/
public function setVideoTutorialFileName($videoTutorialFileName) {
$this->videoTutorialFileName = $videoTutorialFileName;
return $this;
}
/**
* Get videoTutorialFileSize
*
* @return integer
*/
public function getVideoTutorialFileSize() {
return $this->videoTutorialFileSize;
}
/**
* Set videoTutorialFileSize
*
* @param integer $videoTutorialFileSize
*
* @return VideoTutorial
*/
public function setVideoTutorialFileSize($videoTutorialFileSize) {
$this->videoTutorialFileSize = $videoTutorialFileSize;
return $this;
}
/**
* Get videoTutorialFileUpdatedAt
*
* @return \DateTime
*/
public function getVideoTutorialFileUpdatedAt() {
return $this->videoTutorialFileUpdatedAt;
}
/**
* Set videoTutorialFileUpdatedAt
*
* @param \DateTime $videoTutorialFileUpdatedAt
*
* @return VideoTutorial
*/
public function setVideoTutorialFileUpdatedAt($videoTutorialFileUpdatedAt) {
$this->videoTutorialFileUpdatedAt = $videoTutorialFileUpdatedAt;
return $this;
}
/**
* Get isDeleted
*
* @return boolean
*/
public function getIsDeleted()
{
return $this->isDeleted;
}
/**
* Set isDeleted
*
* @param boolean $isDeleted
*
* @return VideoTutorial
*/
public function setIsDeleted($isDeleted)
{
$this->isDeleted = $isDeleted;
return $this;
}
}