<?php
namespace App\Entity;
use App\Repository\ProgramRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JMS\Serializer\Annotation as Serializer;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=ProgramRepository::class)
* @Assert\Callback({"App\Validator\PeriodValidator", "validate"})
* @Serializer\ExclusionPolicy("ALL")
*/
class Program 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({"participation"})
*/
private $label;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $objective;
/**
* @ORM\Column(type="datetime")
* @Serializer\Expose
*/
private $startAt;
/**
* @ORM\Column(type="datetime")
* @Serializer\Expose
*/
private $endAt;
/**
* @ORM\Column(type="text", nullable=true)
* @Serializer\Expose
*/
private $content;
/**
* @ORM\OneToMany(targetEntity=SubsidiaryCompany::class, mappedBy="program", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
*/
private $subsidiaryCompanies;
/**
* @ORM\OneToMany(targetEntity=Job::class, mappedBy="program", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
*/
private $jobs;
/**
* @ORM\OneToMany(targetEntity=Office::class, mappedBy="program", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
*/
private $offices;
/**
* @ORM\OneToMany(targetEntity=Contract::class, mappedBy="program", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
*/
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;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isPublished = false;
/**
* @ORM\OneToOne(targetEntity=ImageManager::class, cascade={"persist", "remove"})
* @Serializer\Expose
*/
private $cover;
/**
* @ORM\OneToMany(targetEntity=ProgramParticipation::class, mappedBy="program", cascade={"persist", "remove"})
*/
private $programParticipations;
/**
* @ORM\ManyToMany(targetEntity=Module::class, inversedBy="programs")
*/
private $modules;
/**
* @ORM\OneToMany(targetEntity=ModuleParticipation::class, mappedBy="program", cascade={"remove"}, fetch="EXTRA_LAZY")
*/
private $moduleParticipations;
/**
* @ORM\OneToMany(targetEntity=ProgramCertificate::class, mappedBy="program", cascade={"persist", "remove"}, fetch="EXTRA_LAZY")
*/
private $certificates;
/**
* @ORM\ManyToMany(targetEntity=User::class, inversedBy="programs")
*/
private $users;
/**
* @ORM\OneToMany(targetEntity=UserProgramParticipation::class, mappedBy="program", cascade={"remove"}, fetch="EXTRA_LAZY")
*/
private $userProgramParticipations;
/**
* @ORM\OneToMany(targetEntity=UserModuleParticipation::class, mappedBy="program", cascade={"remove"}, fetch="EXTRA_LAZY")
*/
private $userModuleParticipations;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $startingNotificationSent = false;
/**
* @Gedmo\Slug(fields={"label"})
* @ORM\Column(length=191)
*/
private $slug;
/**
* @ORM\OneToMany(targetEntity=Target::class, mappedBy="program", fetch="EXTRA_LAZY")
*/
private $targets;
public function __construct()
{
$this->subsidiaryCompanies = new ArrayCollection();
$this->jobs = new ArrayCollection();
$this->offices = new ArrayCollection();
$this->contracts = new ArrayCollection();
$this->programParticipations = new ArrayCollection();
$this->modules = new ArrayCollection();
$this->moduleParticipations = new ArrayCollection();
$this->certificates = new ArrayCollection();
$this->users = new ArrayCollection();
$this->userProgramParticipations = new ArrayCollection();
$this->userModuleParticipations = new ArrayCollection();
$this->targets = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getObjective(): ?string
{
return $this->objective;
}
public function setObjective(?string $objective): self
{
$this->objective = $objective;
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;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
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->setProgram($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->getProgram() === $this) {
$subsidiaryCompany->setProgram(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;
$job->setProgram($this);
}
return $this;
}
public function removeJob(Job $job): self
{
if ($this->jobs->removeElement($job)) {
// set the owning side to null (unless already changed)
if ($job->getProgram() === $this) {
$job->setProgram(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->setProgram($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->getProgram() === $this) {
$office->setProgram(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->setProgram($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->getProgram() === $this) {
$contract->setProgram(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;
}
public function isIsPublished(): ?bool
{
return $this->isPublished;
}
public function setIsPublished(?bool $isPublished): self
{
$this->isPublished = $isPublished;
return $this;
}
public function getCover(): ?ImageManager
{
return $this->cover;
}
public function setCover(?ImageManager $cover): self
{
$this->cover = $cover;
return $this;
}
/**
* @return Collection<int, ProgramParticipation>
*/
public function getProgramParticipations(): Collection
{
return $this->programParticipations;
}
public function addProgramParticipation(ProgramParticipation $programParticipation): self
{
if (!$this->programParticipations->contains($programParticipation)) {
$this->programParticipations[] = $programParticipation;
$programParticipation->setProgram($this);
}
return $this;
}
public function removeProgramParticipation(ProgramParticipation $programParticipation): self
{
if ($this->programParticipations->removeElement($programParticipation)) {
// set the owning side to null (unless already changed)
if ($programParticipation->getProgram() === $this) {
$programParticipation->setProgram(null);
}
}
return $this;
}
/**
* @return Collection<int, Module>
*/
public function getModules(): Collection
{
return $this->modules;
}
public function addModule(Module $module): self
{
if (!$this->modules->contains($module)) {
$this->modules[] = $module;
}
return $this;
}
public function removeModule(Module $module): self
{
$this->modules->removeElement($module);
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->setProgram($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->getProgram() === $this) {
$moduleParticipation->setProgram(null);
}
}
return $this;
}
/**
* @return Collection<int, ProgramCertificate>
*/
public function getCertificates(): Collection
{
return $this->certificates;
}
public function addCertificate(ProgramCertificate $certificate): self
{
if (!$this->certificates->contains($certificate)) {
$this->certificates[] = $certificate;
$certificate->setProgram($this);
}
return $this;
}
public function removeCertificate(ProgramCertificate $certificate): self
{
if ($this->certificates->removeElement($certificate)) {
// set the owning side to null (unless already changed)
if ($certificate->getProgram() === $this) {
$certificate->setProgram(null);
}
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
}
return $this;
}
public function removeUser(User $user): self
{
$this->users->removeElement($user);
return $this;
}
/**
* @return Collection<int, UserProgramParticipation>
*/
public function getUserProgramParticipations(): Collection
{
return $this->userProgramParticipations;
}
public function addUserProgramParticipation(UserProgramParticipation $userProgramParticipation): self
{
if (!$this->userProgramParticipations->contains($userProgramParticipation)) {
$this->userProgramParticipations[] = $userProgramParticipation;
$userProgramParticipation->setProgram($this);
}
return $this;
}
public function removeUserProgramParticipation(UserProgramParticipation $userProgramParticipation): self
{
if ($this->userProgramParticipations->removeElement($userProgramParticipation)) {
// set the owning side to null (unless already changed)
if ($userProgramParticipation->getProgram() === $this) {
$userProgramParticipation->setProgram(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->setProgram($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->getProgram() === $this) {
$userModuleParticipation->setProgram(null);
}
}
return $this;
}
public function isStartingNotificationSent(): ?bool
{
return $this->startingNotificationSent;
}
public function setStartingNotificationSent(?bool $startingNotificationSent): self
{
$this->startingNotificationSent = $startingNotificationSent;
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;
}
/**
* @return Collection<int, Target>
*/
public function getTarges(): Collection
{
return $this->targets;
}
public function addTarget(Target $target): self
{
if (!$this->targets->contains($target)) {
$this->targets[] = $target;
$target->setProgram($this);
}
return $this;
}
public function removeTarget(Target $target): self
{
if ($this->targets->removeElement($target)) {
// set the owning side to null (unless already changed)
if ($target->getProgram() === $this) {
$target->setProgram(null);
}
}
return $this;
}
}