<?php
namespace App\Entity;
use App\Repository\ProgramRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use App\Traits\EntityDateTimeAbleTrait;
use App\Traits\SeoTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Entity(repositoryClass: ProgramRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Program
{
use EntityDateTimeAbleTrait;
use SeoTrait;
const LEVEL_BTS = 1;
const LEVEL_BACHELOR = 2;
const LEVEL_MBA = 3;
const TRANNING_BTS = [
"module1" => "BTS 1ère année",
"module2" => "BTS 2ème année"
];
const TRANNING_BACHELOR = [
"module1" => "Bachelor - 1ère année",
"module2" => "Bachelor - 2ème année",
"module3" => "Bachelor - 3ème année"
];
const TRANNING_MBA = [
"module1" => "MBA/Msc 1 - BAC +4",
"module2" => "MBA/Msc 2 - BAC +5"
];
const STATUS_ACTIVE = 1;
const STATUS_INACTIVE = 0;
const STATUS_IN_BO = 2;
#[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\Column(type: 'string', length: 255, nullable: true)]
private $slug;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $status = null;
#[ORM\ManyToMany(targetEntity: Profile::class, mappedBy: 'programs')]
private Collection $profiles;
#[ORM\ManyToMany(targetEntity: AppointmentPerson::class, mappedBy: 'programs')]
private Collection $appointmentPerson;
#[ORM\OneToMany(targetEntity: Profile::class, mappedBy: 'selectedProgram', orphanRemoval: true)]
private Collection $selectedProfiles;
#[ORM\ManyToMany(targetEntity: Qcm::class, inversedBy: 'programs')]
private Collection $qcm;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $level = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $pace = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $rncp = null;
/**
* @Gedmo\Translatable
*/
#[ORM\Column(type: 'json', nullable: true)]
private ?array $metadata = [];
#[ORM\ManyToMany(targetEntity: Campus::class, inversedBy: 'programs')]
private Collection $campuses;
#[ORM\ManyToMany(targetEntity: Cursus::class, inversedBy: 'programs')]
private Collection $cursus;
#[ORM\OneToOne(targetEntity: Media::class, orphanRemoval: true)]
private ?\App\Entity\Media $brochure = null;
/**
* @Gedmo\Translatable
*/
#[ORM\Column(type: 'text', nullable: true)]
private ?string $description = null;
#[ORM\OneToOne(targetEntity: Media::class, orphanRemoval: true)]
private ?\App\Entity\Media $media = null;
#[ORM\Column(type: 'json', nullable: true)]
private ?array $entreprise = [];
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $specialityId = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $ordering = null;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $isRegister = null;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $isInitial = null;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $isAlternance = null;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $year = null;
public function __construct()
{
$this->profiles = new ArrayCollection();
$this->appointmentPerson = new ArrayCollection();
$this->selectedProfiles = new ArrayCollection();
$this->qcm = new ArrayCollection();
$this->campuses = new ArrayCollection();
$this->cursus = 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;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(?int $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, Profile>
*/
public function getProfiles(): Collection
{
return $this->profiles;
}
public function addProfile(Profile $profile): self
{
if (!$this->profiles->contains($profile)) {
$this->profiles[] = $profile;
$profile->addProgram($this);
}
return $this;
}
public function removeProfile(Profile $profile): self
{
if ($this->profiles->removeElement($profile)) {
$profile->removeProgram($this);
}
return $this;
}
/**
* @return Collection<int, AppointmentPerson>
*/
public function getAppointmentPerson(): Collection
{
return $this->appointmentPerson;
}
public function addAppointmentPerson(AppointmentPerson $appointmentPerson): self
{
if (!$this->appointmentPerson->contains($appointmentPerson)) {
$this->appointmentPerson[] = $appointmentPerson;
$appointmentPerson->addProgram($this);
}
return $this;
}
public function removeAppointmentPerson(AppointmentPerson $appointmentPerson): self
{
if ($this->appointmentPerson->removeElement($appointmentPerson)) {
$appointmentPerson->removeProgram($this);
}
return $this;
}
/**
* @return Collection<int, Profile>
*/
public function getSelectedProfiles(): Collection
{
return $this->selectedProfiles;
}
public function addSelectedProfile(Profile $selectedProfile): self
{
if (!$this->selectedProfiles->contains($selectedProfile)) {
$this->selectedProfiles[] = $selectedProfile;
$selectedProfile->setSelectedProgram($this);
}
return $this;
}
public function removeSelectedProfile(Profile $selectedProfile): self
{
if ($this->selectedProfiles->removeElement($selectedProfile)) {
// set the owning side to null (unless already changed)
if ($selectedProfile->getSelectedProgram() === $this) {
$selectedProfile->setSelectedProgram(null);
}
}
return $this;
}
/**
* @return Collection<int, Qcm>
*/
public function getQcm(): Collection
{
return $this->qcm;
}
public function addQcm(Qcm $qcm): self
{
if (!$this->qcm->contains($qcm)) {
$this->qcm[] = $qcm;
}
return $this;
}
public function removeQcm(Qcm $qcm): self
{
$this->qcm->removeElement($qcm);
return $this;
}
public function getLevel(): ?int
{
return $this->level;
}
public function setLevel(?int $level): self
{
$this->level = $level;
return $this;
}
public function getPace(): ?string
{
return $this->pace;
}
public function setPace(?string $pace): self
{
$this->pace = $pace;
return $this;
}
public function getRncp(): ?string
{
return $this->rncp;
}
public function setRncp(?string $rncp): self
{
$this->rncp = $rncp;
return $this;
}
public function getMetadata(): ?array
{
return $this->metadata;
}
public function setMetadata(?array $metadata): self
{
$this->metadata = $metadata;
return $this;
}
/**
* @return Collection|Campus[]
*/
public function getCampuses(): Collection
{
return $this->campuses;
}
public function addCampus(Campus $campus): self
{
if (!$this->campuses->contains($campus)) {
$this->campuses[] = $campus;
}
return $this;
}
public function removeCampus(Campus $campus): self
{
$this->campuses->removeElement($campus);
return $this;
}
/**
* @return Collection<int, Cursus>
*/
public function getCursus(): Collection
{
return $this->cursus;
}
public function addCursu(Cursus $cursu): self
{
if (!$this->cursus->contains($cursu)) {
$this->cursus[] = $cursu;
}
return $this;
}
public function removeCursu(Cursus $cursu): self
{
$this->cursus->removeElement($cursu);
return $this;
}
public function getBrochure(): ?Media
{
return $this->brochure;
}
public function setBrochure(?Media $brochure): self
{
$this->brochure = $brochure;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getMedia(): ?Media
{
return $this->media;
}
public function setMedia(?Media $media): self
{
$this->media = $media;
return $this;
}
public function getEntreprise(): ?array
{
return $this->entreprise;
}
public function setEntreprise(?array $entreprise): self
{
$this->entreprise = $entreprise;
return $this;
}
public function getSpecialityId(): ?int
{
return $this->specialityId;
}
public function setSpecialityId(?int $specialityId): self
{
$this->specialityId = $specialityId;
return $this;
}
public function getOrdering(): ?int
{
return $this->ordering;
}
public function setOrdering(?int $ordering): self
{
$this->ordering = $ordering;
return $this;
}
public function getIsRegister(): ?bool
{
return $this->isRegister;
}
public function setIsRegister(?bool $isRegister): self
{
$this->isRegister = $isRegister;
return $this;
}
public function getIsInitial(): ?bool
{
return $this->isInitial;
}
public function setIsInitial(?bool $isInitial): self
{
$this->isInitial = $isInitial;
return $this;
}
public function getIsAlternance(): ?bool
{
return $this->isAlternance;
}
public function setIsAlternance(?bool $isAlternance): self
{
$this->isAlternance = $isAlternance;
return $this;
}
public function getYear(): ?int
{
return $this->year;
}
public function setYear(?int $year): self
{
$this->year = $year;
return $this;
}
}