src/Entity/Course.php line 16
<?php
namespace App\Entity;
use App\Repository\CourseRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: CourseRepository::class)]
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]
class Course
{
use SoftDeleteableEntity;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\Column(type: 'uuid', unique: true)]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 191, unique: true)]
#[Gedmo\Slug(fields: ['name'])]
private ?string $slug = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $short_description = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $full_description = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $link = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $link_text = null;
#[ORM\ManyToMany(targetEntity: CourseFieldOfStudy::class, inversedBy: 'courses')]
private Collection $field_of_study;
#[ORM\ManyToMany(targetEntity: CourseEducation::class, inversedBy: 'courses')]
private Collection $educations;
#[ORM\ManyToMany(targetEntity: CourseMaterial::class, inversedBy: 'courses')]
private Collection $materials;
#[ORM\ManyToOne(inversedBy: 'locations')]
private ?CourseLanguage $language = null;
#[ORM\ManyToMany(targetEntity: CourseLocation::class, inversedBy: 'courses')]
private Collection $locations;
#[ORM\ManyToOne(inversedBy: 'courses')]
private ?Partner $partner = null;
#[ORM\ManyToMany(targetEntity: Challenge::class, mappedBy: 'courses')]
private Collection $challenges;
#[ORM\ManyToOne(inversedBy: 'courses')]
private ?CourseCertification $certifications = null;
#[ORM\ManyToOne(inversedBy: 'courses')]
private ?CourseCost $costs = null;
#[ORM\ManyToMany(targetEntity: CoursePeriod::class, inversedBy: 'courses')]
private Collection $periods;
public function __construct()
{
$this->field_of_study = new ArrayCollection();
$this->educations = new ArrayCollection();
$this->materials = new ArrayCollection();
$this->locations = new ArrayCollection();
$this->challenges = new ArrayCollection();
$this->periods = new ArrayCollection();
}
public function __toString() {
return $this->name;
}
public function getId(): ?Uuid
{
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 getShortDescription(): ?string
{
return $this->short_description;
}
public function setShortDescription(string $short_description): self
{
$this->short_description = $short_description;
return $this;
}
public function getFullDescription(): ?string
{
return $this->full_description;
}
public function setFullDescription(string $full_description): self
{
$this->full_description = $full_description;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(?string $link): self
{
$this->link = $link;
return $this;
}
public function getLinkText(): ?string
{
return $this->link_text;
}
public function setLinkText(?string $link_text): self
{
$this->link_text = $link_text;
return $this;
}
/**
* @return Collection<int, CourseFieldOfStudy>
*/
public function getFieldOfStudy(): Collection
{
return $this->field_of_study;
}
public function addFieldOfStudy(CourseFieldOfStudy $fieldOfStudy): self
{
if (!$this->field_of_study->contains($fieldOfStudy)) {
$this->field_of_study->add($fieldOfStudy);
}
return $this;
}
public function removeFieldOfStudy(CourseFieldOfStudy $fieldOfStudy): self
{
$this->field_of_study->removeElement($fieldOfStudy);
return $this;
}
/**
* @return Collection<int, CourseEducation>
*/
public function getEducations(): Collection
{
return $this->educations;
}
public function addEducation(CourseEducation $education): self
{
if (!$this->educations->contains($education)) {
$this->educations->add($education);
}
return $this;
}
public function removeEducation(CourseEducation $education): self
{
$this->educations->removeElement($education);
return $this;
}
/**
* @return Collection<int, CourseMaterial>
*/
public function getMaterials(): Collection
{
return $this->materials;
}
public function addMaterial(CourseMaterial $material): self
{
if (!$this->materials->contains($material)) {
$this->materials->add($material);
}
return $this;
}
public function removeMaterial(CourseMaterial $material): self
{
$this->materials->removeElement($material);
return $this;
}
public function getLanguage(): ?CourseLanguage
{
return $this->language;
}
public function setLanguage(?CourseLanguage $language): self
{
$this->language = $language;
return $this;
}
/**
* @return Collection<int, CourseLocation>
*/
public function getLocations(): Collection
{
return $this->locations;
}
public function addLocation(CourseLocation $location): self
{
if (!$this->locations->contains($location)) {
$this->locations->add($location);
}
return $this;
}
public function removeLocation(CourseLocation $location): self
{
$this->locations->removeElement($location);
return $this;
}
public function getPartner(): ?Partner
{
return $this->partner;
}
public function setPartner(?Partner $partner): self
{
$this->partner = $partner;
return $this;
}
/**
* @return Collection<int, Challenge>
*/
public function getChallenges(): Collection
{
return $this->challenges;
}
public function addChallenge(Challenge $challenge): self
{
if (!$this->challenges->contains($challenge)) {
$this->challenges->add($challenge);
$challenge->addCourse($this);
}
return $this;
}
public function removeChallenge(Challenge $challenge): self
{
if ($this->challenges->removeElement($challenge)) {
$challenge->removeCourse($this);
}
return $this;
}
public function getCertifications(): ?CourseCertification
{
return $this->certifications;
}
public function setCertifications(?CourseCertification $certifications): self
{
$this->certifications = $certifications;
return $this;
}
public function getCosts(): ?CourseCost
{
return $this->costs;
}
public function setCosts(?CourseCost $costs): self
{
$this->costs = $costs;
return $this;
}
/**
* @return Collection<int, CoursePeriod>
*/
public function getPeriods(): Collection
{
return $this->periods;
}
public function addPeriod(CoursePeriod $period): self
{
if (!$this->periods->contains($period)) {
$this->periods->add($period);
}
return $this;
}
public function removePeriod(CoursePeriod $period): self
{
$this->periods->removeElement($period);
return $this;
}
}