src/Entity/Program.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProgramRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use App\Traits\EntityDateTimeAbleTrait;
  7. use App\Traits\SeoTrait;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. #[ORM\Entity(repositoryClass: ProgramRepository::class)]
  11. #[ORM\HasLifecycleCallbacks]
  12. class Program
  13. {
  14.     use EntityDateTimeAbleTrait;
  15.     use SeoTrait;
  16.     const LEVEL_BTS = 1;
  17.     const LEVEL_BACHELOR = 2;
  18.     const LEVEL_MBA = 3;
  19.     const LEVEL_DBA = 4;
  20.     const TRANNING_BTS = [
  21.         "module1" => "BTS 1ère année",
  22.         "module2" => "BTS 2ème année"
  23.     ];
  24.     const TRANNING_BACHELOR = [
  25.         "module1" => "Prépa E1 - 1ère année",
  26.         "module2" => "Prépa E2 - 2ème année",
  27.         "module3" => "Estiam 3 - 3ème année"
  28.     ];
  29.     const TRANNING_MBA = [
  30.         "module1" => "Estiam 4",
  31.         "module2" => "Estiam 5"
  32.     ];
  33.     const TRANNING_PROGRAM31 = [
  34.         "module1" => "Année 1",
  35.         "module2" => "Année 2"
  36.     ];
  37.     const SCHOOLS = [
  38.         1 => "PE Estiam School of IT",
  39.         2 => "PE School of Design",
  40.         3 => "School of Management",
  41.         4 => "Baguette Academy"
  42.     ];
  43.     const STATUS_ACTIVE  = 1;
  44.     const STATUS_INACTIVE = 0;
  45.     const STATUS_IN_BO = 2;
  46.     #[ORM\Id]
  47.     #[ORM\GeneratedValue]
  48.     #[ORM\Column(type: 'integer')]
  49.     private $id;
  50.     /**
  51.      * @Gedmo\Translatable
  52.      */
  53.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  54.     private ?string $name = null;
  55.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  56.     private $slug;
  57.     #[ORM\Column(type: 'integer', nullable: true)]
  58.     private ?int $status = null;
  59.     #[ORM\ManyToMany(targetEntity: Profile::class, mappedBy: 'programs')]
  60.     private Collection $profiles;
  61.     #[ORM\ManyToMany(targetEntity: AppointmentPerson::class, mappedBy: 'programs')]
  62.     private Collection $appointmentPerson;
  63.     #[ORM\OneToMany(targetEntity: Profile::class, mappedBy: 'selectedProgram', orphanRemoval: true)]
  64.     private Collection $selectedProfiles;
  65.     #[ORM\ManyToMany(targetEntity: Qcm::class, inversedBy: 'programs')]
  66.     private Collection $qcm;
  67.     #[ORM\Column(type: 'integer', nullable: true)]
  68.     private ?int $level = null;
  69.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  70.     private ?string $pace = null;
  71.     #[ORM\Column(type: 'string', length: 255, nullable: true)]
  72.     private ?string $rncp = null;
  73.     /**
  74.      * @Gedmo\Translatable
  75.      */
  76.     #[ORM\Column(type: 'json', nullable: true)]
  77.     private ?array $metadata = [];
  78.     #[ORM\ManyToMany(targetEntity: Campus::class, inversedBy: 'programs')]
  79.     private Collection $campuses;
  80.     #[ORM\ManyToMany(targetEntity: Cursus::class, inversedBy: 'programs')]
  81.     private Collection $cursus;
  82.     #[ORM\OneToOne(targetEntity: Media::class, orphanRemoval: true)]
  83.     private ?\App\Entity\Media $brochure = null;
  84.     /**
  85.      * @Gedmo\Translatable
  86.      */
  87.     #[ORM\Column(type: 'text', nullable: true)]
  88.     private ?string $description = null;
  89.     #[ORM\OneToOne(targetEntity: Media::class, orphanRemoval: true)]
  90.     private ?\App\Entity\Media $media = null;
  91.     #[ORM\Column(type: 'json', nullable: true)]
  92.     private ?array $entreprise = [];
  93.     #[ORM\Column(type: 'integer', nullable: true)]
  94.     private ?int $specialityId = null;
  95.     #[ORM\Column(type: 'integer', nullable: true)]
  96.     private ?int $ordering = null;
  97.     #[ORM\Column(type: 'boolean', nullable: true)]
  98.     private ?bool $isRegister = null;
  99.     #[ORM\Column(type: 'boolean', nullable: true)]
  100.     private ?bool $isInitial = null;
  101.     #[ORM\Column(type: 'boolean', nullable: true)]
  102.     private ?bool $isAlternance = null;
  103.     #[ORM\Column(type: 'integer', nullable: true)]
  104.     private ?int $year = null;
  105.     #[ORM\Column(nullable: true)]
  106.     private ?int $rncpLevel = null;
  107.     #[ORM\OneToMany(mappedBy: 'program', targetEntity: Invoice::class)]
  108.     private Collection $invoices;
  109.     #[ORM\Column(nullable: true)]
  110.     private ?bool $isAgent = null;
  111.     #[ORM\Column(nullable: true)]
  112.     private ?int $school = null;
  113.     public function __construct()
  114.     {
  115.         $this->profiles = new ArrayCollection();
  116.         $this->appointmentPerson = new ArrayCollection();
  117.         $this->selectedProfiles = new ArrayCollection();
  118.         $this->qcm = new ArrayCollection();
  119.         $this->campuses = new ArrayCollection();
  120.         $this->cursus = new ArrayCollection();
  121.         $this->invoices = new ArrayCollection();
  122.     }
  123.     public function getId(): ?int
  124.     {
  125.         return $this->id;
  126.     }
  127.     public function getName(): ?string
  128.     {
  129.         return $this->name;
  130.     }
  131.     public function setName(?string $name): self
  132.     {
  133.         $this->name = $name;
  134.         return $this;
  135.     }
  136.     public function getSlug(): ?string
  137.     {
  138.         return $this->slug;
  139.     }
  140.     public function setSlug(?string $slug): self
  141.     {
  142.         $this->slug = $slug;
  143.         return $this;
  144.     }
  145.     public function getStatus(): ?int
  146.     {
  147.         return $this->status;
  148.     }
  149.     public function setStatus(?int $status): self
  150.     {
  151.         $this->status = $status;
  152.         return $this;
  153.     }
  154.     /**
  155.      * @return Collection<int, Profile>
  156.      */
  157.     public function getProfiles(): Collection
  158.     {
  159.         return $this->profiles;
  160.     }
  161.     public function addProfile(Profile $profile): self
  162.     {
  163.         if (!$this->profiles->contains($profile)) {
  164.             $this->profiles[] = $profile;
  165.             $profile->addProgram($this);
  166.         }
  167.         return $this;
  168.     }
  169.     public function removeProfile(Profile $profile): self
  170.     {
  171.         if ($this->profiles->removeElement($profile)) {
  172.             $profile->removeProgram($this);
  173.         }
  174.         return $this;
  175.     }
  176.     /**
  177.      * @return Collection<int, AppointmentPerson>
  178.      */
  179.     public function getAppointmentPerson(): Collection
  180.     {
  181.         return $this->appointmentPerson;
  182.     }
  183.     public function addAppointmentPerson(AppointmentPerson $appointmentPerson): self
  184.     {
  185.         if (!$this->appointmentPerson->contains($appointmentPerson)) {
  186.             $this->appointmentPerson[] = $appointmentPerson;
  187.             $appointmentPerson->addProgram($this);
  188.         }
  189.         return $this;
  190.     }
  191.     public function removeAppointmentPerson(AppointmentPerson $appointmentPerson): self
  192.     {
  193.         if ($this->appointmentPerson->removeElement($appointmentPerson)) {
  194.             $appointmentPerson->removeProgram($this);
  195.         }
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return Collection<int, Profile>
  200.      */
  201.     public function getSelectedProfiles(): Collection
  202.     {
  203.         return $this->selectedProfiles;
  204.     }
  205.     public function addSelectedProfile(Profile $selectedProfile): self
  206.     {
  207.         if (!$this->selectedProfiles->contains($selectedProfile)) {
  208.             $this->selectedProfiles[] = $selectedProfile;
  209.             $selectedProfile->setSelectedProgram($this);
  210.         }
  211.         return $this;
  212.     }
  213.     public function removeSelectedProfile(Profile $selectedProfile): self
  214.     {
  215.         if ($this->selectedProfiles->removeElement($selectedProfile)) {
  216.             // set the owning side to null (unless already changed)
  217.             if ($selectedProfile->getSelectedProgram() === $this) {
  218.                 $selectedProfile->setSelectedProgram(null);
  219.             }
  220.         }
  221.         return $this;
  222.     }
  223.     /**
  224.      * @return Collection<int, Qcm>
  225.      */
  226.     public function getQcm(): Collection
  227.     {
  228.         return $this->qcm;
  229.     }
  230.     public function addQcm(Qcm $qcm): self
  231.     {
  232.         if (!$this->qcm->contains($qcm)) {
  233.             $this->qcm[] = $qcm;
  234.         }
  235.         return $this;
  236.     }
  237.     public function removeQcm(Qcm $qcm): self
  238.     {
  239.         $this->qcm->removeElement($qcm);
  240.         return $this;
  241.     }
  242.     public function getLevel(): ?int
  243.     {
  244.         return $this->level;
  245.     }
  246.     public function setLevel(?int $level): self
  247.     {
  248.         $this->level = $level;
  249.         return $this;
  250.     }
  251.     public function getPace(): ?string
  252.     {
  253.         return $this->pace;
  254.     }
  255.     public function setPace(?string $pace): self
  256.     {
  257.         $this->pace = $pace;
  258.         return $this;
  259.     }
  260.     public function getRncp(): ?string
  261.     {
  262.         return $this->rncp;
  263.     }
  264.     public function setRncp(?string $rncp): self
  265.     {
  266.         $this->rncp = $rncp;
  267.         return $this;
  268.     }
  269.     public function getMetadata(): ?array
  270.     {
  271.         return $this->metadata;
  272.     }
  273.     public function setMetadata(?array $metadata): self
  274.     {
  275.         $this->metadata = $metadata;
  276.         return $this;
  277.     }
  278.     /**
  279.      * @return Collection|Campus[]
  280.      */
  281.     public function getCampuses(): Collection
  282.     {
  283.         return $this->campuses;
  284.     }
  285.     public function addCampus(Campus $campus): self
  286.     {
  287.         if (!$this->campuses->contains($campus)) {
  288.             $this->campuses[] = $campus;
  289.         }
  290.         return $this;
  291.     }
  292.     public function removeCampus(Campus $campus): self
  293.     {
  294.         $this->campuses->removeElement($campus);
  295.         return $this;
  296.     }
  297.     /**
  298.      * @return Collection<int, Cursus>
  299.      */
  300.     public function getCursus(): Collection
  301.     {
  302.         return $this->cursus;
  303.     }
  304.     public function addCursu(Cursus $cursu): self
  305.     {
  306.         if (!$this->cursus->contains($cursu)) {
  307.             $this->cursus[] = $cursu;
  308.         }
  309.         return $this;
  310.     }
  311.     public function removeCursu(Cursus $cursu): self
  312.     {
  313.         $this->cursus->removeElement($cursu);
  314.         return $this;
  315.     }
  316.     public function getBrochure(): ?Media
  317.     {
  318.         return $this->brochure;
  319.     }
  320.     public function setBrochure(?Media $brochure): self
  321.     {
  322.         $this->brochure = $brochure;
  323.         return $this;
  324.     }
  325.     public function getDescription(): ?string
  326.     {
  327.         return $this->description;
  328.     }
  329.     public function setDescription(?string $description): self
  330.     {
  331.         $this->description = $description;
  332.         return $this;
  333.     }
  334.     public function getMedia(): ?Media
  335.     {
  336.         return $this->media;
  337.     }
  338.     public function setMedia(?Media $media): self
  339.     {
  340.         $this->media = $media;
  341.         return $this;
  342.     }
  343.     public function getEntreprise(): ?array
  344.     {
  345.         return $this->entreprise;
  346.     }
  347.     public function setEntreprise(?array $entreprise): self
  348.     {
  349.         $this->entreprise = $entreprise;
  350.         return $this;
  351.     }
  352.     public function getSpecialityId(): ?int
  353.     {
  354.         return $this->specialityId;
  355.     }
  356.     public function setSpecialityId(?int $specialityId): self
  357.     {
  358.         $this->specialityId = $specialityId;
  359.         return $this;
  360.     }
  361.     public function getOrdering(): ?int
  362.     {
  363.         return $this->ordering;
  364.     }
  365.     public function setOrdering(?int $ordering): self
  366.     {
  367.         $this->ordering = $ordering;
  368.         return $this;
  369.     }
  370.     public function getIsRegister(): ?bool
  371.     {
  372.         return $this->isRegister;
  373.     }
  374.     public function setIsRegister(?bool $isRegister): self
  375.     {
  376.         $this->isRegister = $isRegister;
  377.         return $this;
  378.     }
  379.     public function getIsInitial(): ?bool
  380.     {
  381.         return $this->isInitial;
  382.     }
  383.     public function setIsInitial(?bool $isInitial): self
  384.     {
  385.         $this->isInitial = $isInitial;
  386.         return $this;
  387.     }
  388.     public function getIsAlternance(): ?bool
  389.     {
  390.         return $this->isAlternance;
  391.     }
  392.     public function setIsAlternance(?bool $isAlternance): self
  393.     {
  394.         $this->isAlternance = $isAlternance;
  395.         return $this;
  396.     }
  397.     public function getYear(): ?int
  398.     {
  399.         return $this->year;
  400.     }
  401.     public function setYear(?int $year): self
  402.     {
  403.         $this->year = $year;
  404.         return $this;
  405.     }
  406.     public function getRncpLevel(): ?int
  407.     {
  408.         return $this->rncpLevel;
  409.     }
  410.     public function setRncpLevel(?int $rncpLevel): static
  411.     {
  412.         $this->rncpLevel = $rncpLevel;
  413.         return $this;
  414.     }
  415.     /**
  416.      * @return Collection<int, Invoice>
  417.      */
  418.     public function getInvoices(): Collection
  419.     {
  420.         return $this->invoices;
  421.     }
  422.     public function addInvoice(Invoice $invoice): static
  423.     {
  424.         if (!$this->invoices->contains($invoice)) {
  425.             $this->invoices->add($invoice);
  426.             $invoice->setProgram($this);
  427.         }
  428.         return $this;
  429.     }
  430.     public function removeInvoice(Invoice $invoice): static
  431.     {
  432.         if ($this->invoices->removeElement($invoice)) {
  433.             // set the owning side to null (unless already changed)
  434.             if ($invoice->getProgram() === $this) {
  435.                 $invoice->setProgram(null);
  436.             }
  437.         }
  438.         return $this;
  439.     }
  440.     public function isIsAgent(): ?bool
  441.     {
  442.         return $this->isAgent;
  443.     }
  444.     public function setIsAgent(?bool $isAgent): static
  445.     {
  446.         $this->isAgent = $isAgent;
  447.         return $this;
  448.     }
  449.     public function getSchool(): ?int
  450.     {
  451.         return $this->school;
  452.     }
  453.     public function setSchool(?int $school): static
  454.     {
  455.         $this->school = $school;
  456.         return $this;
  457.     }
  458. }