vendor/sulu/sulu/src/Sulu/Bundle/MediaBundle/Entity/MediaType.php line 21

  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. /**
  15.  * MediaType.
  16.  */
  17. class MediaType
  18. {
  19.     /**
  20.      * @var string
  21.      */
  22.     private $name;
  23.     /**
  24.      * @var string|null
  25.      */
  26.     private $description;
  27.     /**
  28.      * @var int
  29.      */
  30.     private $id;
  31.     /**
  32.      * @var DoctrineCollection<int, MediaInterface>
  33.      *
  34.      * @Exclude
  35.      */
  36.     private $media;
  37.     /**
  38.      * Constructor.
  39.      */
  40.     public function __construct()
  41.     {
  42.         $this->media = new ArrayCollection();
  43.     }
  44.     /**
  45.      * Set name.
  46.      *
  47.      * @param string $name
  48.      *
  49.      * @return MediaType
  50.      */
  51.     public function setName($name)
  52.     {
  53.         $this->name $name;
  54.         return $this;
  55.     }
  56.     /**
  57.      * Get name.
  58.      *
  59.      * @return string
  60.      */
  61.     public function getName()
  62.     {
  63.         return $this->name;
  64.     }
  65.     /**
  66.      * Set description.
  67.      *
  68.      * @param string|null $description
  69.      *
  70.      * @return MediaType
  71.      */
  72.     public function setDescription($description)
  73.     {
  74.         $this->description $description;
  75.         return $this;
  76.     }
  77.     /**
  78.      * Get description.
  79.      *
  80.      * @return string|null
  81.      */
  82.     public function getDescription()
  83.     {
  84.         return $this->description;
  85.     }
  86.     /**
  87.      * To force id = 1 in load fixtures.
  88.      *
  89.      * @param int $id
  90.      *
  91.      * @return void
  92.      */
  93.     public function setId($id)
  94.     {
  95.         $this->id $id;
  96.     }
  97.     /**
  98.      * Get id.
  99.      *
  100.      * @return int
  101.      */
  102.     public function getId()
  103.     {
  104.         return $this->id;
  105.     }
  106.     /**
  107.      * Add media.
  108.      *
  109.      * @return MediaType
  110.      */
  111.     public function addMedia(MediaInterface $media)
  112.     {
  113.         $this->media[] = $media;
  114.         return $this;
  115.     }
  116.     /**
  117.      * Remove media.
  118.      *
  119.      * @return void
  120.      */
  121.     public function removeMedia(MediaInterface $media)
  122.     {
  123.         $this->media->removeElement($media);
  124.     }
  125.     /**
  126.      * Get media.
  127.      *
  128.      * @return DoctrineCollection<int, MediaInterface>
  129.      */
  130.     public function getMedia()
  131.     {
  132.         return $this->media;
  133.     }
  134. }