vendor/sulu/sulu/src/Sulu/Bundle/MediaBundle/Entity/Media.php line 22

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\MediaBundle\Entity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection as DoctrineCollection;
  13. use JMS\Serializer\Annotation\Exclude;
  14. use Sulu\Component\Persistence\Model\AuditableTrait;
  15. /**
  16.  * Media.
  17.  */
  18. class Media implements MediaInterface
  19. {
  20.     use AuditableTrait;
  21.     /**
  22.      * @var int
  23.      */
  24.     protected $id;
  25.     /**
  26.      * @var DoctrineCollection<int, File>
  27.      */
  28.     protected $files;
  29.     /**
  30.      * @var CollectionInterface
  31.      *
  32.      * @Exclude
  33.      */
  34.     protected $collection;
  35.     /**
  36.      * @var MediaType
  37.      */
  38.     protected $type;
  39.     /**
  40.      * @var MediaInterface|null
  41.      */
  42.     protected $previewImage;
  43.     /**
  44.      * Constructor.
  45.      */
  46.     public function __construct()
  47.     {
  48.         $this->files = new ArrayCollection();
  49.     }
  50.     public function getId()
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function addFile(File $files)
  55.     {
  56.         $this->files[] = $files;
  57.         return $this;
  58.     }
  59.     public function removeFile(File $files)
  60.     {
  61.         $this->files->removeElement($files);
  62.     }
  63.     public function getFiles()
  64.     {
  65.         return $this->files;
  66.     }
  67.     public function setCollection(CollectionInterface $collection)
  68.     {
  69.         $this->collection $collection;
  70.         return $this;
  71.     }
  72.     public function getCollection()
  73.     {
  74.         return $this->collection;
  75.     }
  76.     public function setType(MediaType $type)
  77.     {
  78.         $this->type $type;
  79.         return $this;
  80.     }
  81.     public function getType()
  82.     {
  83.         return $this->type;
  84.     }
  85.     public function setPreviewImage(?MediaInterface $previewImage null)
  86.     {
  87.         $this->previewImage $previewImage;
  88.         return $this;
  89.     }
  90.     public function getPreviewImage()
  91.     {
  92.         return $this->previewImage;
  93.     }
  94. }