<?php
namespace App\Entity;
use App\Entity\Media;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=VideoMarkerRepository::class)
*/
class VideoMarker
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var string
* @ORM\Column(type="string", length=255)
* @Assert\Length(min=3, max=255, minMessage="Le titre est trop court !")
*/
private $title;
/**
* @var string
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string", length=255)
*/
private $timecode;
/**
* @ORM\Column(type="integer")
*/
private $duration;
/**
* @ORM\ManyToMany(targetEntity=Media::class, cascade={"persist"}, fetch="EAGER")
* @ORM\JoinTable(name="video_markers__attachments",
* joinColumns={@ORM\JoinColumn(name="video_marker_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="attachment_id", referencedColumnName="id")}
* )
*/
private $attachments;
/**
* @ORM\ManyToOne(targetEntity=Article::class, inversedBy="videoMarkers", fetch="EAGER")
* @ORM\JoinColumn(nullable=false)
*/
private $article;
public function __construct()
{
$this->attachments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTimecode(): ?string
{
return $this->timecode;
}
public function setTimecode(string $timecode): self
{
$this->timecode = $timecode;
return $this;
}
public function getAttachments()
{
return $this->attachments;
}
public function setAttachments( $attachments): self
{
foreach ($attachments as $attachment)
$this->addAttachment($attachment);
return $this;
}
public function addAttachment(Media $attachment): self
{
if ($this->attachments->contains($attachment))
return $this;
else
$this->attachments->add($attachment);
return $this;
}
/**
* Get the value of article
*/
public function getArticle(): ?Article
{
return $this->article;
}
/**
* Set the value of article
*
* @return self
*/
public function setArticle(?Article $article): self
{
$this->article = $article;
return $this;
}
/**
* Get the value of duration
* @return int|NULL
*/
public function getDuration(): ?int
{
return $this->duration;
}
/**
* Set the value of duration
*
* @return self
*/
public function setDuration(int $duration)
{
$this->duration = $duration;
return $this;
}
/**
* Get the value of title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set the value of title
*
* @param string $title
*
* @return self
*/
public function setTitle(string $title)
{
$this->title = $title;
return $this;
}
/**
* Get the value of description
*
* @return string
*/
public function getDescription(): ?String
{
return $this->description;
}
/**
* Set the value of description
*
* @param string $description
*
* @return self
*/
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
}