src/Entity/Course.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CourseRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  10. use Symfony\Component\Uid\Uuid;
  11. #[ORM\Entity(repositoryClassCourseRepository::class)]
  12. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  13. class Course
  14. {
  15.     use SoftDeleteableEntity;
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  18.     #[ORM\Column(type'uuid'uniquetrue)]
  19.     #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
  20.     private ?Uuid $id null;
  21.     #[ORM\Column(length255)]
  22.     private ?string $name null;
  23.     #[ORM\Column(length191uniquetrue)]
  24.     #[Gedmo\Slug(fields: ['name'])]
  25.     private ?string $slug null;
  26.     #[ORM\Column(typeTypes::TEXT)]
  27.     private ?string $short_description null;
  28.     #[ORM\Column(typeTypes::TEXT)]
  29.     private ?string $full_description null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $link null;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $link_text null;
  34.     #[ORM\ManyToMany(targetEntityCourseFieldOfStudy::class, inversedBy'courses')]
  35.     private Collection $field_of_study;
  36.     #[ORM\ManyToMany(targetEntityCourseEducation::class, inversedBy'courses')]
  37.     private Collection $educations;
  38.     #[ORM\ManyToMany(targetEntityCourseMaterial::class, inversedBy'courses')]
  39.     private Collection $materials;
  40.     #[ORM\ManyToOne(inversedBy'locations')]
  41.     private ?CourseLanguage $language null;
  42.     #[ORM\ManyToMany(targetEntityCourseLocation::class, inversedBy'courses')]
  43.     private Collection $locations;
  44.     #[ORM\ManyToOne(inversedBy'courses')]
  45.     private ?Partner $partner null;
  46.     #[ORM\ManyToMany(targetEntityChallenge::class, mappedBy'courses')]
  47.     private Collection $challenges;
  48.     #[ORM\ManyToOne(inversedBy'courses')]
  49.     private ?CourseCertification $certifications null;
  50.     #[ORM\ManyToOne(inversedBy'courses')]
  51.     private ?CourseCost $costs null;
  52.     #[ORM\ManyToMany(targetEntityCoursePeriod::class, inversedBy'courses')]
  53.     private Collection $periods;
  54.     public function __construct()
  55.     {
  56.         $this->field_of_study = new ArrayCollection();
  57.         $this->educations = new ArrayCollection();
  58.         $this->materials = new ArrayCollection();
  59.         $this->locations = new ArrayCollection();
  60.         $this->challenges = new ArrayCollection();
  61.         $this->periods = new ArrayCollection();
  62.     }
  63.     public function __toString() {
  64.         return $this->name;
  65.     }
  66.     public function getId(): ?Uuid
  67.     {
  68.         return $this->id;
  69.     }
  70.     public function getName(): ?string
  71.     {
  72.         return $this->name;
  73.     }
  74.     public function setName(string $name): self
  75.     {
  76.         $this->name $name;
  77.         return $this;
  78.     }
  79.     public function getSlug(): ?string
  80.     {
  81.         return $this->slug;
  82.     }
  83.     public function setSlug(string $slug): self
  84.     {
  85.         $this->slug $slug;
  86.         return $this;
  87.     }
  88.     public function getShortDescription(): ?string
  89.     {
  90.         return $this->short_description;
  91.     }
  92.     public function setShortDescription(string $short_description): self
  93.     {
  94.         $this->short_description $short_description;
  95.         return $this;
  96.     }
  97.     public function getFullDescription(): ?string
  98.     {
  99.         return $this->full_description;
  100.     }
  101.     public function setFullDescription(string $full_description): self
  102.     {
  103.         $this->full_description $full_description;
  104.         return $this;
  105.     }
  106.     public function getLink(): ?string
  107.     {
  108.         return $this->link;
  109.     }
  110.     public function setLink(?string $link): self
  111.     {
  112.         $this->link $link;
  113.         return $this;
  114.     }
  115.     public function getLinkText(): ?string
  116.     {
  117.         return $this->link_text;
  118.     }
  119.     public function setLinkText(?string $link_text): self
  120.     {
  121.         $this->link_text $link_text;
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection<int, CourseFieldOfStudy>
  126.      */
  127.     public function getFieldOfStudy(): Collection
  128.     {
  129.         return $this->field_of_study;
  130.     }
  131.     public function addFieldOfStudy(CourseFieldOfStudy $fieldOfStudy): self
  132.     {
  133.         if (!$this->field_of_study->contains($fieldOfStudy)) {
  134.             $this->field_of_study->add($fieldOfStudy);
  135.         }
  136.         return $this;
  137.     }
  138.     public function removeFieldOfStudy(CourseFieldOfStudy $fieldOfStudy): self
  139.     {
  140.         $this->field_of_study->removeElement($fieldOfStudy);
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return Collection<int, CourseEducation>
  145.      */
  146.     public function getEducations(): Collection
  147.     {
  148.         return $this->educations;
  149.     }
  150.     public function addEducation(CourseEducation $education): self
  151.     {
  152.         if (!$this->educations->contains($education)) {
  153.             $this->educations->add($education);
  154.         }
  155.         return $this;
  156.     }
  157.     public function removeEducation(CourseEducation $education): self
  158.     {
  159.         $this->educations->removeElement($education);
  160.         return $this;
  161.     }
  162.     /**
  163.      * @return Collection<int, CourseMaterial>
  164.      */
  165.     public function getMaterials(): Collection
  166.     {
  167.         return $this->materials;
  168.     }
  169.     public function addMaterial(CourseMaterial $material): self
  170.     {
  171.         if (!$this->materials->contains($material)) {
  172.             $this->materials->add($material);
  173.         }
  174.         return $this;
  175.     }
  176.     public function removeMaterial(CourseMaterial $material): self
  177.     {
  178.         $this->materials->removeElement($material);
  179.         return $this;
  180.     }
  181.     public function getLanguage(): ?CourseLanguage
  182.     {
  183.         return $this->language;
  184.     }
  185.     public function setLanguage(?CourseLanguage $language): self
  186.     {
  187.         $this->language $language;
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return Collection<int, CourseLocation>
  192.      */
  193.     public function getLocations(): Collection
  194.     {
  195.         return $this->locations;
  196.     }
  197.     public function addLocation(CourseLocation $location): self
  198.     {
  199.         if (!$this->locations->contains($location)) {
  200.             $this->locations->add($location);
  201.         }
  202.         return $this;
  203.     }
  204.     public function removeLocation(CourseLocation $location): self
  205.     {
  206.         $this->locations->removeElement($location);
  207.         return $this;
  208.     }
  209.     public function getPartner(): ?Partner
  210.     {
  211.         return $this->partner;
  212.     }
  213.     public function setPartner(?Partner $partner): self
  214.     {
  215.         $this->partner $partner;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, Challenge>
  220.      */
  221.     public function getChallenges(): Collection
  222.     {
  223.         return $this->challenges;
  224.     }
  225.     public function addChallenge(Challenge $challenge): self
  226.     {
  227.         if (!$this->challenges->contains($challenge)) {
  228.             $this->challenges->add($challenge);
  229.             $challenge->addCourse($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeChallenge(Challenge $challenge): self
  234.     {
  235.         if ($this->challenges->removeElement($challenge)) {
  236.             $challenge->removeCourse($this);
  237.         }
  238.         return $this;
  239.     }
  240.     public function getCertifications(): ?CourseCertification
  241.     {
  242.         return $this->certifications;
  243.     }
  244.     public function setCertifications(?CourseCertification $certifications): self
  245.     {
  246.         $this->certifications $certifications;
  247.         return $this;
  248.     }
  249.     public function getCosts(): ?CourseCost
  250.     {
  251.         return $this->costs;
  252.     }
  253.     public function setCosts(?CourseCost $costs): self
  254.     {
  255.         $this->costs $costs;
  256.         return $this;
  257.     }
  258.     /**
  259.      * @return Collection<int, CoursePeriod>
  260.      */
  261.     public function getPeriods(): Collection
  262.     {
  263.         return $this->periods;
  264.     }
  265.     public function addPeriod(CoursePeriod $period): self
  266.     {
  267.         if (!$this->periods->contains($period)) {
  268.             $this->periods->add($period);
  269.         }
  270.         return $this;
  271.     }
  272.     public function removePeriod(CoursePeriod $period): self
  273.     {
  274.         $this->periods->removeElement($period);
  275.         return $this;
  276.     }
  277. }