<?php
namespace App\Entity\Um6p;
use App\Repository\Um6p\ModuleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
use Symfony\Component\PropertyAccess\PropertyAccess;
/**
* @ORM\Entity(repositoryClass=ModuleRepository::class)
*/
class Module implements TranslatableInterface
{
use TranslatableTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $position;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $publier;
/**
* @ORM\ManyToOne(targetEntity=Formation::class, inversedBy="modules", cascade={"persist"})
*/
private $formation;
/**
* @ORM\ManyToMany(targetEntity=Prof::class, inversedBy="modules")
* @ORM\OrderBy({"position" = "ASC"})
*/
private $profs;
protected $translations;
public function __construct()
{
$this->profs = new ArrayCollection();
}
public function __toString(){
return $this->getTitre();
}
public function getDtitre(){
return $this->getTitre();
}
public function getId(): ?int
{
return $this->id;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
public function isPublier(): ?bool
{
return $this->publier;
}
public function setPublier(?bool $publier): self
{
$this->publier = $publier;
return $this;
}
public function getFormation(): ?Formation
{
return $this->formation;
}
public function setFormation(?Formation $formation): self
{
$this->formation = $formation;
return $this;
}
/**
* @return Collection|Prof[]
*/
public function getProfs(): Collection
{
return $this->profs;
}
public function addProf(Prof $prof): self
{
if (!$this->profs->contains($prof)) {
$this->profs[] = $prof;
$prof->addElement($this);
}
return $this;
}
public function removeProf(Prof $prof): self
{
if ($this->profs->removeElement($prof)) {
$prof->removeElement($this);
}
return $this;
}
public function __call($method, $arguments)
{
return PropertyAccess::createPropertyAccessor()->getValue($this->translate(), $method);
}
}