src/Entity/VideoTutorial.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. #[ORM\Entity(repositoryClass'App\Repository\VideoTutorialRepository')]
  8. #[ORM\Table(name'video_tutorial')]
  9. #[Vich\Uploadable]
  10. class VideoTutorial
  11. {
  12.     #[ORM\Column(type'boolean')]
  13.     private bool $isDeleted false;
  14.     #[ORM\Column(type'datetime')]
  15.     private DateTime $createdAt;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private ?string $title null;
  18.     #[ORM\Column(type'text'nullabletrue)]
  19.     private ?string $description null;
  20.     #[ORM\Column(type'integer')]
  21.     #[ORM\GeneratedValue(strategy'AUTO')]
  22.     #[ORM\Id]
  23.     private int $id;
  24.     #[Vich\UploadableField(
  25.         mapping'videoTutorial',
  26.         fileNameProperty'videoTutorialFileName',
  27.         size'videoTutorialFileSize',
  28.         mimeType'video/mp4'
  29.     )]
  30.     private ?File $videoTutorialFile null;
  31.     #[ORM\Column(type'string'length255nullabletrue)]
  32.     private ?string $videoTutorialFileName null;
  33.     #[ORM\Column(type'integer'nullabletrue)]
  34.     private ?int $videoTutorialFileSize null;
  35.     #[ORM\Column(type'datetime'nullabletrue)]
  36.     private ?DateTime $videoTutorialFileUpdatedAt null;
  37.     public function __construct() {
  38.         $this->createdAt = new \DateTime();
  39.     }
  40.     public function __toString() {
  41.         return "#" $this->id " - " $this->title;
  42.     }
  43.     public function getVideoTutorialFile() {
  44.         return $this->videoTutorialFile;
  45.     }
  46.     /**
  47.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  48.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  49.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  50.      * must be able to accept an instance of 'File' as the bundle will inject one here
  51.      * during Doctrine hydration.
  52.      *
  53.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
  54.      */
  55.     public function setVideoTutorialFile(File $image null) {
  56.         $this->videoTutorialFile $image;
  57.         if (null !== $image) {
  58. // It is required that at least one field changes if you are using doctrine
  59. // otherwise the event listeners won't be called and the file is lost
  60.             $this->videoTutorialFileUpdatedAt = new \DateTime();
  61.         }
  62.     }
  63.     /**
  64.      * Get id
  65.      *
  66.      * @return int
  67.      */
  68.     public function getId() {
  69.         return $this->id;
  70.     }
  71.     /**
  72.      * Get createdAt
  73.      *
  74.      * @return \DateTime
  75.      */
  76.     public function getCreatedAt() {
  77.         return $this->createdAt;
  78.     }
  79.     /**
  80.      * Set createdAt
  81.      *
  82.      * @param \DateTime $createdAt
  83.      *
  84.      * @return VideoTutorial
  85.      */
  86.     public function setCreatedAt($createdAt) {
  87.         $this->createdAt $createdAt;
  88.         return $this;
  89.     }
  90.     /**
  91.      * Get title
  92.      *
  93.      * @return string
  94.      */
  95.     public function getTitle() {
  96.         return $this->title;
  97.     }
  98.     /**
  99.      * Set title
  100.      *
  101.      * @param string $title
  102.      *
  103.      * @return VideoTutorial
  104.      */
  105.     public function setTitle($title) {
  106.         $this->title $title;
  107.         return $this;
  108.     }
  109.     /**
  110.      * Get description
  111.      *
  112.      * @return string
  113.      */
  114.     public function getDescription() {
  115.         return $this->description;
  116.     }
  117.     /**
  118.      * Set description
  119.      *
  120.      * @param string $description
  121.      *
  122.      * @return VideoTutorial
  123.      */
  124.     public function setDescription($description) {
  125.         $this->description $description;
  126.         return $this;
  127.     }
  128.     /**
  129.      * Set tutorialVideoFileName
  130.      *
  131.      * @param string $tutorialVideoFileName
  132.      *
  133.      * @return VideoTutorial
  134.      */
  135.     public function setTutorialVideoFileName($tutorialVideoFileName) {
  136.         $this->tutorialVideoFileName $tutorialVideoFileName;
  137.         return $this;
  138.     }
  139.     /**
  140.      * Get tutorialVideoFileName
  141.      *
  142.      * @return string
  143.      */
  144.     public function getTutorialVideoFileName() {
  145.         return $this->tutorialVideoFileName;
  146.     }
  147.     /**
  148.      * Set tutorialVideoFileSize
  149.      *
  150.      * @param integer $tutorialVideoFileSize
  151.      *
  152.      * @return VideoTutorial
  153.      */
  154.     public function setTutorialVideoFileSize($tutorialVideoFileSize) {
  155.         $this->tutorialVideoFileSize $tutorialVideoFileSize;
  156.         return $this;
  157.     }
  158.     /**
  159.      * Get tutorialVideoFileSize
  160.      *
  161.      * @return integer
  162.      */
  163.     public function getTutorialVideoFileSize() {
  164.         return $this->tutorialVideoFileSize;
  165.     }
  166.     /**
  167.      * Set tutorialVideoFileUpdatedAt
  168.      *
  169.      * @param \DateTime $tutorialVideoFileUpdatedAt
  170.      *
  171.      * @return VideoTutorial
  172.      */
  173.     public function setTutorialVideoFileUpdatedAt($tutorialVideoFileUpdatedAt) {
  174.         $this->tutorialVideoFileUpdatedAt $tutorialVideoFileUpdatedAt;
  175.         return $this;
  176.     }
  177.     /**
  178.      * Get tutorialVideoFileUpdatedAt
  179.      *
  180.      * @return \DateTime
  181.      */
  182.     public function getTutorialVideoFileUpdatedAt() {
  183.         return $this->tutorialVideoFileUpdatedAt;
  184.     }
  185.     /**
  186.      * Get videoTutorialFileName
  187.      *
  188.      * @return string
  189.      */
  190.     public function getVideoTutorialFileName() {
  191.         return $this->videoTutorialFileName;
  192.     }
  193.     /**
  194.      * Set videoTutorialFileName
  195.      *
  196.      * @param string $videoTutorialFileName
  197.      *
  198.      * @return VideoTutorial
  199.      */
  200.     public function setVideoTutorialFileName($videoTutorialFileName) {
  201.         $this->videoTutorialFileName $videoTutorialFileName;
  202.         return $this;
  203.     }
  204.     /**
  205.      * Get videoTutorialFileSize
  206.      *
  207.      * @return integer
  208.      */
  209.     public function getVideoTutorialFileSize() {
  210.         return $this->videoTutorialFileSize;
  211.     }
  212.     /**
  213.      * Set videoTutorialFileSize
  214.      *
  215.      * @param integer $videoTutorialFileSize
  216.      *
  217.      * @return VideoTutorial
  218.      */
  219.     public function setVideoTutorialFileSize($videoTutorialFileSize) {
  220.         $this->videoTutorialFileSize $videoTutorialFileSize;
  221.         return $this;
  222.     }
  223.     /**
  224.      * Get videoTutorialFileUpdatedAt
  225.      *
  226.      * @return \DateTime
  227.      */
  228.     public function getVideoTutorialFileUpdatedAt() {
  229.         return $this->videoTutorialFileUpdatedAt;
  230.     }
  231.     /**
  232.      * Set videoTutorialFileUpdatedAt
  233.      *
  234.      * @param \DateTime $videoTutorialFileUpdatedAt
  235.      *
  236.      * @return VideoTutorial
  237.      */
  238.     public function setVideoTutorialFileUpdatedAt($videoTutorialFileUpdatedAt) {
  239.         $this->videoTutorialFileUpdatedAt $videoTutorialFileUpdatedAt;
  240.         return $this;
  241.     }
  242.     /**
  243.      * Get isDeleted
  244.      *
  245.      * @return boolean
  246.      */
  247.     public function getIsDeleted()
  248.     {
  249.         return $this->isDeleted;
  250.     }
  251.     /**
  252.      * Set isDeleted
  253.      *
  254.      * @param boolean $isDeleted
  255.      *
  256.      * @return VideoTutorial
  257.      */
  258.     public function setIsDeleted($isDeleted)
  259.     {
  260.         $this->isDeleted $isDeleted;
  261.         return $this;
  262.     }
  263. }