<?php
namespace App\Entity;
use App\Repository\CursusRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Entity(repositoryClass: CursusRepository::class)]
class Cursus
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
/**
* @Gedmo\Translatable
*/
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $name = null;
#[ORM\ManyToMany(targetEntity: Program::class, mappedBy: 'cursus')]
private Collection $programs;
/**
* @Gedmo\Translatable
*/
#[ORM\Column(type: 'text', nullable: true)]
private ?string $description = null;
/**
* @Gedmo\Translatable
*/
#[ORM\Column(type: 'text', nullable: true)]
private ?string $cours = null;
#[ORM\OneToOne(targetEntity: Media::class, cascade: ['persist', 'remove'])]
private ?\App\Entity\Media $media = null;
public function __construct()
{
$this->programs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection<int, Program>
*/
public function getPrograms(): Collection
{
return $this->programs;
}
public function addProgram(Program $program): self
{
if (!$this->programs->contains($program)) {
$this->programs[] = $program;
$program->addCursu($this);
}
return $this;
}
public function removeProgram(Program $program): self
{
if ($this->programs->removeElement($program)) {
$program->removeCursu($this);
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCours(): ?string
{
return $this->cours;
}
public function setCours(?string $cours): self
{
$this->cours = $cours;
return $this;
}
public function getMedia(): ?Media
{
return $this->media;
}
public function setMedia(?Media $media): self
{
$this->media = $media;
return $this;
}
}