<?phpnamespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * @ORM\Entity(repositoryClass="App\Repository\TypeDocumentRepository") * @UniqueEntity("type") */class TypeDocument{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255,unique=true) */ private $type; /** * @ORM\Column(type="string", length=255) */ private $slug; /** * @return mixed */ public function getSlug() { return $this->slug; } /** * @param mixed $slug */ public function setSlug($slug): void { $this->slug = $slug; } /** * @ORM\OneToMany(targetEntity="App\Entity\Media", mappedBy="typeDocument") */ private $typedocument; public function __construct() { $this->typedocument = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; return $this; } /** * @return Collection|Media[] */ public function getTypedocument(): Collection { return $this->typedocument; } public function addTypedocument(Media $typedocument): self { if (!$this->typedocument->contains($typedocument)) { $this->typedocument[] = $typedocument; $typedocument->setTypeDocument($this); } return $this; } public function removeTypedocument(Media $typedocument): self { if ($this->typedocument->contains($typedocument)) { $this->typedocument->removeElement($typedocument); // set the owning side to null (unless already changed) if ($typedocument->getTypeDocument() === $this) { $typedocument->setTypeDocument(null); } } return $this; } public function __toString(){ return $this->getType(); }}