<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Defr\PhpMimeType\MimeType;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\MediaRepository")
* @Vich\Uploadable
*/
class Media
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*/
public function setName($name): void
{
$this->name = $name;
}
/**
* @Assert\File(
* mimeTypes = {"application/pdf", "application/x-pdf", "application/zip", "video/flv", "video/mpeg", "video/mp4"},
* mimeTypesMessage = "SVP seuls les fichiers d'extension pdf, flv, mpeg, mp4 et zip sont requis."
*
* )
* @Vich\UploadableField(mapping="medias", fileNameProperty="name")
* @var File
*/
private $namefile;
/**
* @Assert\File(
* mimeTypes = {"image/png", "image/gif", "image/jpeg", "image/jpg"},
* mimeTypesMessage = "SVP seuls les fichiers image d'extension png, gif, jpeg et jpg sont requis."
*
* )
* @Vich\UploadableField(mapping="medias", fileNameProperty="name")
* @var File
*/
private $imagefile;
/**
* @ORM\Column(type="boolean")
*/
private $visible;
/**
* @ORM\Column(type="datetime")
*/
private $createAt;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\TypeDocument", inversedBy="typedocument")
* @ORM\JoinColumn(nullable=false)
*/
private $typeDocument;
/**
* @ORM\Column(type="text")
*/
private $description;
/**
* @ORM\Column(type="string", length=255)
*/
private $typefile;
public function getId(): ?int
{
return $this->id;
}
/**
* @return File|null
*/
public function getNamefile()
{
return $this->namefile;
}
/**
* @param File $namefile
*/
public function setNamefile(File $namefile): void
{
$this->namefile = $namefile;
}
public function getVisible(): ?bool
{
return $this->visible;
}
public function setVisible(bool $visible): self
{
$this->visible = $visible;
return $this;
}
public function getCreateAt(): ?\DateTimeInterface
{
return $this->createAt;
}
public function setCreateAt(\DateTimeInterface $createAt): self
{
$this->createAt = $createAt;
return $this;
}
/**
* @return File
*/
public function getImagefile()
{
return $this->imagefile;
}
/**
* @param File $imagefile
*/
public function setImagefile(File $imagefile): void
{
$this->imagefile = $imagefile;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
/**
* toString
*
* @return string
*/
public function __toString() {
return (string) $this->getTitle();
}
public function getTypeDocument(): ?TypeDocument
{
return $this->typeDocument;
}
public function setTypeDocument(?TypeDocument $typeDocument): self
{
$this->typeDocument = $typeDocument;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getTypefile(): ?string
{
return $this->typefile;
}
public function setTypefile(string $typefile): self
{
$this->typefile = $typefile;
return $this;
}
}