<?php
namespace App\Entity;
use App\Repository\ModuleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use JMS\Serializer\Annotation as Serializer;
/**
* @ORM\Entity(repositoryClass=ModuleRepository::class)
* @Serializer\ExclusionPolicy("ALL")
*/
class Module extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Expose
* @Serializer\Groups({"participation"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Serializer\Expose
* @Serializer\Groups({"historic", "participation", "live_details"})
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
* @Serializer\Expose
*/
private $description;
/**
* @ORM\ManyToMany(targetEntity=Taxonomy::class, inversedBy="modules", cascade={"remove"})
*/
private $taxonomies;
/**
* @ORM\Column(type="text", nullable=true)
* @Serializer\Expose
*/
private $objective;
/**
* @ORM\OneToMany(targetEntity=LearningProgress::class, mappedBy="module", cascade={"remove"})
*/
private $learningProgress;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Expose
*/
private $label;
/**
* @ORM\Column(type="datetime", nullable=true)
* @Serializer\Expose
*/
private $startAt;
/**
* @ORM\Column(type="datetime", nullable=true)
* @Serializer\Expose
* @Serializer\Groups({"historic"})
*/
private $endAt;
/**
* @ORM\OneToMany(targetEntity=ModuleView::class, mappedBy="module", cascade={"persist"})
*/
private $moduleViews;
/**
* @ORM\OneToMany(targetEntity=ModuleLike::class, mappedBy="module", cascade={"persist"})
*/
private $moduleLikes;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $publishedAt;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="modulePublishers")
* @ORM\JoinColumn(name="module_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
private $publishedBy;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isPublished = false;
/**
* @ORM\OneToMany(targetEntity=SubsidiaryCompany::class, mappedBy="module", cascade={"persist"})
*/
private $subsidiaryCompanies;
/**
* @ORM\OneToMany(targetEntity=Office::class, mappedBy="module", cascade={"persist"})
*/
private $offices;
/**
* @ORM\OneToMany(targetEntity=Contract::class, mappedBy="module",cascade={"persist"})
*/
private $contracts;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAllJobs = true;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAllOffices = true;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAllContracts = true;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAllSubsidiaryCompanies = true;
/**
* @Gedmo\Slug(fields={"name"})
* @ORM\Column(length=191)
*/
private $slug;
/**
* @ORM\OneToOne(targetEntity=ImageManager::class, cascade={"persist", "remove"})
* @Serializer\Expose
*/
private $cover;
/**
* @ORM\OneToMany(targetEntity=ModuleItem::class, mappedBy="module", orphanRemoval="true", cascade={"persist"})
*/
private $moduleItems;
/**
* @ORM\OneToMany(targetEntity=ModuleParticipation::class, mappedBy="module", cascade={"persist"})
*/
private $moduleParticipations;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isPublic;
/**
* @ORM\ManyToMany(targetEntity=User::class, inversedBy="modules")
* @ORM\JoinColumn(onDelete="CASCADE")
* @Serializer\Expose
*/
private $coaches;
/**
* @ORM\OneToMany(targetEntity=ModuleComment::class, mappedBy="module")
*/
private $moduleComments;
/**
* @ORM\OneToMany(targetEntity=ModuleNotice::class, mappedBy="module")
*/
private $moduleNotices;
/**
* @ORM\OneToMany(targetEntity=Subject::class, mappedBy="module")
*/
private $subjects;
/**
* @ORM\ManyToMany(targetEntity=Program::class, mappedBy="modules", cascade={"remove"})
*/
private $programs;
/**
* @ORM\OneToMany(targetEntity=ModuleInscription::class, mappedBy="module")
*/
private $moduleInscriptions;
/**
* @ORM\OneToMany(targetEntity=UserModuleParticipation::class, mappedBy="module")
*/
private $userModuleParticipations;
/**
* @ORM\ManyToMany(targetEntity=Course::class, mappedBy="modules")
*/
private $courses;
/**
* @ORM\ManyToMany(targetEntity=Live::class, mappedBy="modules")
*/
private $lives;
/**
* @ORM\ManyToMany(targetEntity=Quiz::class, mappedBy="modules")
*/
private $quiz;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isMadeVisible;
/**
* @ORM\OneToMany(targetEntity=UserQuizQuestion::class, mappedBy="module")
*/
private $userQuizQuestions;
/**
* @ORM\ManyToOne(targetEntity=Partenaire::class)
*/
private $partenaire;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAuthoredByCofina;
/**
* @ORM\OneToMany(targetEntity=Notification::class, mappedBy="module")
*/
private $notifications;
/**
* @ORM\ManyToMany(targetEntity=Job::class, inversedBy="modules")
*/
private $jobs;
/**
* @ORM\OneToMany(targetEntity=ModuleObjective::class, mappedBy="module", cascade={"persist"})
*/
private $moduleObjectives;
public function __construct()
{
$this->taxonomies = new ArrayCollection();
$this->learningProgress = new ArrayCollection();
$this->moduleViews = new ArrayCollection();
$this->moduleLikes = new ArrayCollection();
$this->subsidiaryCompanies = new ArrayCollection();
$this->offices = new ArrayCollection();
$this->contracts = new ArrayCollection();
$this->moduleItems = new ArrayCollection();
$this->moduleParticipations = new ArrayCollection();
$this->coaches = new ArrayCollection();
$this->moduleComments = new ArrayCollection();
$this->moduleNotices = new ArrayCollection();
$this->subjects = new ArrayCollection();
$this->programs = new ArrayCollection();
$this->moduleInscriptions = new ArrayCollection();
$this->userModuleParticipations = new ArrayCollection();
$this->courses = new ArrayCollection();
$this->lives = new ArrayCollection();
$this->quiz = new ArrayCollection();
$this->userQuizQuestions = new ArrayCollection();
$this->notifications = new ArrayCollection();
$this->jobs = new ArrayCollection();
$this->moduleObjectives = 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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, Taxonomy>
*/
public function getTaxonomies(): Collection
{
return $this->taxonomies;
}
public function addTaxonomy(Taxonomy $taxonomy): self
{
if (!$this->taxonomies->contains($taxonomy)) {
$this->taxonomies[] = $taxonomy;
}
return $this;
}
public function removeTaxonomy(Taxonomy $taxonomy): self
{
$this->taxonomies->removeElement($taxonomy);
return $this;
}
public function getObjective(): ?string
{
return $this->objective;
}
public function setObjective(?string $objective): self
{
$this->objective = $objective;
return $this;
}
/**
* @return Collection<int, LearningProgress>
*/
public function getLearningProgress(): Collection
{
return $this->learningProgress;
}
public function addLearningProgress(LearningProgress $learningProgress): self
{
if (!$this->learningProgress->contains($learningProgress)) {
$this->learningProgress[] = $learningProgress;
$learningProgress->setModule($this);
}
return $this;
}
public function removeLearningProgress(LearningProgress $learningProgress): self
{
if ($this->learningProgress->removeElement($learningProgress)) {
// set the owning side to null (unless already changed)
if ($learningProgress->getModule() === $this) {
$learningProgress->setModule(null);
}
}
return $this;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(?string $label): self
{
$this->label = $label;
return $this;
}
public function getStartAt(): ?\DateTimeInterface
{
return $this->startAt;
}
public function setStartAt(?\DateTimeInterface $startAt): self
{
$this->startAt = $startAt;
return $this;
}
public function getEndAt(): ?\DateTimeInterface
{
return $this->endAt;
}
public function setEndAt(?\DateTimeInterface $endAt): self
{
$this->endAt = $endAt;
return $this;
}
/**
* @return Collection<int, ModuleView>
*/
public function getModuleViews(): Collection
{
return $this->moduleViews;
}
public function addModuleView(ModuleView $moduleView): self
{
if (!$this->moduleViews->contains($moduleView)) {
$this->moduleViews[] = $moduleView;
$moduleView->setModule($this);
}
return $this;
}
public function removeModuleView(ModuleView $moduleView): self
{
if ($this->moduleViews->removeElement($moduleView)) {
// set the owning side to null (unless already changed)
if ($moduleView->getModule() === $this) {
$moduleView->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, ModuleLike>
*/
public function getModuleLikes(): Collection
{
return $this->moduleLikes;
}
public function addModuleLike(ModuleLike $moduleLike): self
{
if (!$this->moduleLikes->contains($moduleLike)) {
$this->moduleLikes[] = $moduleLike;
$moduleLike->setModule($this);
}
return $this;
}
public function removeModuleLike(ModuleLike $moduleLike): self
{
if ($this->moduleLikes->removeElement($moduleLike)) {
// set the owning side to null (unless already changed)
if ($moduleLike->getModule() === $this) {
$moduleLike->setModule(null);
}
}
return $this;
}
public function getPublishedAt(): ?\DateTimeInterface
{
return $this->publishedAt;
}
public function setPublishedAt(?\DateTimeInterface $publishedAt): self
{
$this->publishedAt = $publishedAt;
return $this;
}
public function getPublishedBy(): ?User
{
return $this->publishedBy;
}
public function setPublishedBy(?User $publishedBy): self
{
$this->publishedBy = $publishedBy;
return $this;
}
public function isIsPublished(): ?bool
{
return $this->isPublished;
}
public function setIsPublished(?bool $isPublished): self
{
$this->isPublished = $isPublished;
return $this;
}
/**
* @return Collection<int, SubsidiaryCompany>
*/
public function getSubsidiaryCompanies(): Collection
{
return $this->subsidiaryCompanies;
}
public function addSubsidiaryCompany(SubsidiaryCompany $subsidiaryCompany): self
{
if (!$this->subsidiaryCompanies->contains($subsidiaryCompany)) {
$this->subsidiaryCompanies[] = $subsidiaryCompany;
$subsidiaryCompany->setModule($this);
}
return $this;
}
public function removeSubsidiaryCompany(SubsidiaryCompany $subsidiaryCompany): self
{
if ($this->subsidiaryCompanies->removeElement($subsidiaryCompany)) {
// set the owning side to null (unless already changed)
if ($subsidiaryCompany->getModule() === $this) {
$subsidiaryCompany->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, Office>
*/
public function getOffices(): Collection
{
return $this->offices;
}
public function addOffice(Office $office): self
{
if (!$this->offices->contains($office)) {
$this->offices[] = $office;
$office->setModule($this);
}
return $this;
}
public function removeOffice(Office $office): self
{
if ($this->offices->removeElement($office)) {
// set the owning side to null (unless already changed)
if ($office->getModule() === $this) {
$office->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, Contract>
*/
public function getContracts(): Collection
{
return $this->contracts;
}
public function addContract(Contract $contract): self
{
if (!$this->contracts->contains($contract)) {
$this->contracts[] = $contract;
$contract->setModule($this);
}
return $this;
}
public function removeContract(Contract $contract): self
{
if ($this->contracts->removeElement($contract)) {
// set the owning side to null (unless already changed)
if ($contract->getModule() === $this) {
$contract->setModule(null);
}
}
return $this;
}
public function isIsAllJobs(): ?bool
{
return $this->isAllJobs;
}
public function setIsAllJobs(?bool $isAllJobs): self
{
$this->isAllJobs = $isAllJobs;
return $this;
}
public function isIsAllOffices(): ?bool
{
return $this->isAllOffices;
}
public function setIsAllOffices(?bool $isAllOffices): self
{
$this->isAllOffices = $isAllOffices;
return $this;
}
public function isIsAllContracts(): ?bool
{
return $this->isAllContracts;
}
public function setIsAllContracts(?bool $isAllContracts): self
{
$this->isAllContracts = $isAllContracts;
return $this;
}
public function isIsAllSubsidiaryCompanies(): ?bool
{
return $this->isAllSubsidiaryCompanies;
}
public function setIsAllSubsidiaryCompanies(?bool $isAllSubsidiaryCompanies): self
{
$this->isAllSubsidiaryCompanies = $isAllSubsidiaryCompanies;
return $this;
}
/**
* Get the value of slug
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set the value of slug
*
* @return self
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
public function getCover(): ?ImageManager
{
return $this->cover;
}
public function setCover(?ImageManager $cover): self
{
$this->cover = $cover;
return $this;
}
/**
* @return Collection<int, ModuleItem>
*/
public function getModuleItems(): Collection
{
return $this->moduleItems;
}
public function addModuleItem(ModuleItem $moduleItem): self
{
if (!$this->moduleItems->contains($moduleItem)) {
$this->moduleItems[] = $moduleItem;
$moduleItem->setModule($this);
}
return $this;
}
public function removeModuleItem(ModuleItem $moduleItem): self
{
if ($this->moduleItems->removeElement($moduleItem)) {
// set the owning side to null (unless already changed)
if ($moduleItem->getModule() === $this) {
$moduleItem->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, ModuleParticipation>
*/
public function getModuleParticipations(): Collection
{
return $this->moduleParticipations;
}
public function addModuleParticipation(ModuleParticipation $moduleParticipation): self
{
if (!$this->moduleParticipations->contains($moduleParticipation)) {
$this->moduleParticipations[] = $moduleParticipation;
$moduleParticipation->setModule($this);
}
return $this;
}
public function removeModuleParticipation(ModuleParticipation $moduleParticipation): self
{
if ($this->moduleParticipations->removeElement($moduleParticipation)) {
// set the owning side to null (unless already changed)
if ($moduleParticipation->getModule() === $this) {
$moduleParticipation->setModule(null);
}
}
return $this;
}
public function isIsPublic(): ?bool
{
return $this->isPublic;
}
public function setIsPublic(?bool $isPublic): self
{
$this->isPublic = $isPublic;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getCoaches(): Collection
{
return $this->coaches;
}
public function addCoach(User $coach): self
{
if (!$this->coaches->contains($coach)) {
$this->coaches[] = $coach;
}
return $this;
}
public function removeCoach(User $coach): self
{
$this->coaches->removeElement($coach);
return $this;
}
/**
* @return Collection<int, ModuleComment>
*/
public function getModuleComments(): Collection
{
return $this->moduleComments;
}
public function addModuleComment(ModuleComment $moduleComment): self
{
if (!$this->moduleComments->contains($moduleComment)) {
$this->moduleComments[] = $moduleComment;
$moduleComment->setModule($this);
}
return $this;
}
public function removeModuleComment(ModuleComment $moduleComment): self
{
if ($this->moduleComments->removeElement($moduleComment)) {
// set the owning side to null (unless already changed)
if ($moduleComment->getModule() === $this) {
$moduleComment->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, ModuleNotice>
*/
public function getModuleNotices(): Collection
{
return $this->moduleNotices;
}
public function addModuleNotice(ModuleNotice $moduleNotice): self
{
if (!$this->moduleNotices->contains($moduleNotice)) {
$this->moduleNotices[] = $moduleNotice;
$moduleNotice->setModule($this);
}
return $this;
}
public function removeModuleNotice(ModuleNotice $moduleNotice): self
{
if ($this->moduleNotices->removeElement($moduleNotice)) {
// set the owning side to null (unless already changed)
if ($moduleNotice->getModule() === $this) {
$moduleNotice->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, Subject>
*/
public function getSubjects(): Collection
{
return $this->subjects;
}
public function addSubject(Subject $subject): self
{
if (!$this->subjects->contains($subject)) {
$this->subjects[] = $subject;
$subject->setModule($this);
}
return $this;
}
public function removeSubject(Subject $subject): self
{
if ($this->subjects->removeElement($subject)) {
// set the owning side to null (unless already changed)
if ($subject->getModule() === $this) {
$subject->setModule(null);
}
}
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->addModule($this);
}
return $this;
}
public function removeProgram(Program $program): self
{
if ($this->programs->removeElement($program)) {
$program->removeModule($this);
}
return $this;
}
/**
* @return Collection<int, ModuleInscription>
*/
public function getModuleInscriptions(): Collection
{
return $this->moduleInscriptions;
}
public function addModuleInscription(ModuleInscription $moduleInscription): self
{
if (!$this->moduleInscriptions->contains($moduleInscription)) {
$this->moduleInscriptions[] = $moduleInscription;
$moduleInscription->setModule($this);
}
return $this;
}
public function removeModuleInscription(ModuleInscription $moduleInscription): self
{
if ($this->moduleInscriptions->removeElement($moduleInscription)) {
// set the owning side to null (unless already changed)
if ($moduleInscription->getModule() === $this) {
$moduleInscription->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, UserModuleParticipation>
*/
public function getUserModuleParticipations(): Collection
{
return $this->userModuleParticipations;
}
public function addUserModuleParticipation(UserModuleParticipation $userModuleParticipation): self
{
if (!$this->userModuleParticipations->contains($userModuleParticipation)) {
$this->userModuleParticipations[] = $userModuleParticipation;
$userModuleParticipation->setModule($this);
}
return $this;
}
public function removeUserModuleParticipation(UserModuleParticipation $userModuleParticipation): self
{
if ($this->userModuleParticipations->removeElement($userModuleParticipation)) {
// set the owning side to null (unless already changed)
if ($userModuleParticipation->getModule() === $this) {
$userModuleParticipation->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, Course>
*/
public function getCourses(): Collection
{
return $this->courses;
}
public function addCourse(Course $course): self
{
if (!$this->courses->contains($course)) {
$this->courses[] = $course;
$course->addModule($this);
}
return $this;
}
public function removeCourse(Course $course): self
{
if ($this->courses->removeElement($course)) {
$course->removeModule($this);
}
return $this;
}
/**
* @return Collection<int, Live>
*/
public function getLives(): Collection
{
return $this->lives;
}
public function addLife(Live $life): self
{
if (!$this->lives->contains($life)) {
$this->lives[] = $life;
$life->addModule($this);
}
return $this;
}
public function removeLife(Live $life): self
{
if ($this->lives->removeElement($life)) {
$life->removeModule($this);
}
return $this;
}
/**
* @return Collection<int, Quiz>
*/
public function getQuiz(): Collection
{
return $this->quiz;
}
public function addQuiz(Quiz $quiz): self
{
if (!$this->quiz->contains($quiz)) {
$this->quiz[] = $quiz;
$quiz->addModule($this);
}
return $this;
}
public function removeQuiz(Quiz $quiz): self
{
if ($this->quiz->removeElement($quiz)) {
$quiz->removeModule($this);
}
return $this;
}
public function isIsMadeVisible(): ?bool
{
return $this->isMadeVisible;
}
public function setIsMadeVisible(?bool $isMadeVisible): self
{
$this->isMadeVisible = $isMadeVisible;
return $this;
}
/**
* @return Collection<int, UserQuizQuestion>
*/
public function getUserQuizQuestions(): Collection
{
return $this->userQuizQuestions;
}
public function addUserQuizQuestion(UserQuizQuestion $userQuizQuestion): self
{
if (!$this->userQuizQuestions->contains($userQuizQuestion)) {
$this->userQuizQuestions[] = $userQuizQuestion;
$userQuizQuestion->setModule($this);
}
return $this;
}
public function removeUserQuizQuestion(UserQuizQuestion $userQuizQuestion): self
{
if ($this->userQuizQuestions->removeElement($userQuizQuestion)) {
// set the owning side to null (unless already changed)
if ($userQuizQuestion->getModule() === $this) {
$userQuizQuestion->setModule(null);
}
}
return $this;
}
public function getPartenaire(): ?Partenaire
{
return $this->partenaire;
}
public function setPartenaire(?Partenaire $partenaire): self
{
$this->partenaire = $partenaire;
return $this;
}
public function isIsAuthoredByCofina(): ?bool
{
return $this->isAuthoredByCofina;
}
public function setIsAuthoredByCofina(?bool $isAuthoredByCofina): self
{
$this->isAuthoredByCofina = $isAuthoredByCofina;
return $this;
}
/**
* @return Collection<int, Notification>
*/
public function getNotifications(): Collection
{
return $this->notifications;
}
public function addNotification(Notification $notification): self
{
if (!$this->notifications->contains($notification)) {
$this->notifications[] = $notification;
$notification->setModule($this);
}
return $this;
}
public function removeNotification(Notification $notification): self
{
if ($this->notifications->removeElement($notification)) {
// set the owning side to null (unless already changed)
if ($notification->getModule() === $this) {
$notification->setModule(null);
}
}
return $this;
}
/**
* @return Collection<int, Job>
*/
public function getJobs(): Collection
{
return $this->jobs;
}
public function addJob(Job $job): self
{
if (!$this->jobs->contains($job)) {
$this->jobs[] = $job;
}
return $this;
}
public function removeJob(Job $job): self
{
$this->jobs->removeElement($job);
return $this;
}
/**
* @return Collection<int, ModuleObjectives>
*/
public function getModuleObjectives(): Collection
{
return $this->moduleObjectives;
}
public function addModuleObjective(ModuleObjective $moduleObjective): self
{
if (!$this->moduleObjectives->contains($moduleObjective)) {
$this->moduleObjectives[] = $moduleObjective;
$moduleObjective->setModule($this);
}
return $this;
}
public function removeModuleObjective(ModuleObjective $moduleObjective): self
{
if ($this->moduleObjectives->removeElement($moduleObjective)) {
// set the owning side to null (unless already changed)
if ($moduleObjective->getModule() === $this) {
$moduleObjective->setModule(null);
}
}
return $this;
}
}