<?php
namespace App\Entity\Um6p;
use App\Repository\Um6p\FormationRepository;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
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=FormationRepository::class)
*/
class Formation 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\OneToMany(targetEntity=Module::class, mappedBy="formation", cascade={"persist","remove"})
* @ORM\OrderBy({"position" = "ASC"})
*/
private $modules;
protected $translations;
public function __toString(){
return $this->getTitre();
}
public function getDtitre(){
return $this->getTitre();
}
public function getDduree(){
return $this->getDuree();
}
public function __construct()
{
$this->modules = new ArrayCollection();
}
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;
}
/**
* @return Collection|Module[]
*/
public function getModules(): Collection
{
return $this->modules;
}
public function addModule(Module $module): self
{
if (!$this->modules->contains($module)) {
$this->modules[] = $module;
$module->setFormation($this);
}
return $this;
}
public function removeModule(Module $module): self
{
if ($this->modules->removeElement($module)) {
// set the owning side to null (unless already changed)
if ($module->getFormation() === $this) {
$module->setFormation(null);
}
}
return $this;
}
public function __call($method, $arguments)
{
return PropertyAccess::createPropertyAccessor()->getValue($this->translate(), $method);
}
}