src/Entity/VideoMarker.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Media;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass=VideoMarkerRepository::class)
  9.  */
  10. class VideoMarker
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @var string
  20.      * @ORM\Column(type="string", length=255)
  21.      * @Assert\Length(min=3, max=255, minMessage="Le titre est trop court !")
  22.      */
  23.     private $title;
  24.     /**
  25.      * @var string
  26.      * @ORM\Column(type="text", nullable=true)
  27.      */
  28.     private $description;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      */
  32.     private $timecode;
  33.     /**
  34.      * @ORM\Column(type="integer")
  35.      */
  36.     private $duration;
  37.     /**
  38.      * @ORM\ManyToMany(targetEntity=Media::class, cascade={"persist"}, fetch="EAGER")
  39.      * @ORM\JoinTable(name="video_markers__attachments",
  40.      *      joinColumns={@ORM\JoinColumn(name="video_marker_id", referencedColumnName="id")},
  41.      *      inverseJoinColumns={@ORM\JoinColumn(name="attachment_id", referencedColumnName="id")}
  42.      *      )
  43.      */
  44.     private $attachments;
  45.     /**
  46.      * @ORM\ManyToOne(targetEntity=Article::class, inversedBy="videoMarkers", fetch="EAGER")
  47.      * @ORM\JoinColumn(nullable=false)
  48.      */
  49.     private $article;
  50.     public function __construct()
  51.     {
  52.         $this->attachments = new ArrayCollection();
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getTimecode(): ?string
  59.     {
  60.         return $this->timecode;
  61.     }
  62.     public function setTimecode(string $timecode): self
  63.     {
  64.         $this->timecode $timecode;
  65.         return $this;
  66.     }
  67.     public function getAttachments()
  68.     {
  69.         return $this->attachments;
  70.     }
  71.     public function setAttachments$attachments): self
  72.     {
  73.         foreach ($attachments as $attachment)
  74.             $this->addAttachment($attachment);
  75.         return $this;
  76.     }
  77.     public function addAttachment(Media $attachment): self
  78.     {
  79.         if ($this->attachments->contains($attachment))
  80.             return $this;
  81.         else
  82.             $this->attachments->add($attachment);
  83.         return $this;
  84.     }
  85.     /**
  86.      * Get the value of article
  87.      */
  88.     public function getArticle(): ?Article
  89.     {
  90.         return $this->article;
  91.     }
  92.     /**
  93.      * Set the value of article
  94.      *
  95.      * @return  self
  96.      */
  97.     public function setArticle(?Article $article): self
  98.     {
  99.         $this->article $article;
  100.         return $this;
  101.     }
  102.     /**
  103.      * Get the value of duration
  104.      * @return  int|NULL
  105.      */
  106.     public function getDuration(): ?int
  107.     {
  108.         return $this->duration;
  109.     }
  110.     /**
  111.      * Set the value of duration
  112.      *
  113.      * @return  self
  114.      */
  115.     public function setDuration(int $duration)
  116.     {
  117.         $this->duration $duration;
  118.         return $this;
  119.     }
  120.     /**
  121.      * Get the value of title
  122.      *
  123.      * @return  string
  124.      */
  125.     public function getTitle()
  126.     {
  127.         return $this->title;
  128.     }
  129.     /**
  130.      * Set the value of title
  131.      *
  132.      * @param  string  $title
  133.      *
  134.      * @return  self
  135.      */
  136.     public function setTitle(string $title)
  137.     {
  138.         $this->title $title;
  139.         return $this;
  140.     }
  141.     /**
  142.      * Get the value of description
  143.      *
  144.      * @return  string
  145.      */ 
  146.     public function getDescription(): ?String
  147.     {
  148.         return $this->description;
  149.     }
  150.     /**
  151.      * Set the value of description
  152.      *
  153.      * @param  string  $description
  154.      *
  155.      * @return  self
  156.      */ 
  157.     public function setDescription(string $description): self
  158.     {
  159.         $this->description $description;
  160.         return $this;
  161.     }
  162. }