src/Entity/CourseLicense.php line 16
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\CourseLicenseRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\UX\Turbo\Attribute\Broadcast;#[ORM\Entity(repositoryClass: CourseLicenseRepository::class)]#[ApiResource]#[Broadcast]class CourseLicense{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\Column(type: Types::TEXT)]private ?string $description = null;#[ORM\ManyToMany(targetEntity: Course::class, inversedBy: 'courseLicenses')]private Collection $courses;#[ORM\OneToMany(mappedBy: 'courseLicense', targetEntity: LicensePrice::class, cascade: ['persist'])]private Collection $licensePrices;#[ORM\Column]private ?float $basePrice = null;#[ORM\ManyToOne(inversedBy: 'courseLicenses')]private ?Catalog $catalog = null;#[ORM\OneToMany(mappedBy: 'courseLicense', targetEntity: LicenseStatus::class)]private Collection $licenseStatuses;#[ORM\OneToMany(mappedBy: 'courseLicense', targetEntity: CorporationDiscount::class)]private Collection $corporationDiscounts;#[ORM\OneToMany(mappedBy: 'course', targetEntity: AddOn::class)]private Collection $addOns;public function __construct(){$this->courses = new ArrayCollection();$this->licensePrices = new ArrayCollection();$this->setDescription('Beschreibung');$this->licenseStatuses = new ArrayCollection();$this->corporationDiscounts = new ArrayCollection();$this->addOns = new ArrayCollection();}public function __toString(): string{return $this->name;}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, Course>*/public function getCourses(): Collection{return $this->courses;}public function addCourse(Course $course): self{if (!$this->courses->contains($course)) {$this->courses->add($course);}return $this;}public function removeCourse(Course $course): self{$this->courses->removeElement($course);return $this;}/*** @return Collection<int, LicensePrice>*/public function getLicensePrices(): Collection{return $this->licensePrices;}public function addLicensePrice(LicensePrice $licensePrice): self{if (!$this->licensePrices->contains($licensePrice)) {$this->licensePrices->add($licensePrice);$licensePrice->setCourseLicense($this);}return $this;}public function removeLicensePrice(LicensePrice $licensePrice): self{if ($this->licensePrices->removeElement($licensePrice)) {// set the owning side to null (unless already changed)if ($licensePrice->getCourseLicense() === $this) {$licensePrice->setCourseLicense(null);}}return $this;}public function getBasePrice(): ?float{return $this->basePrice;}public function setBasePrice(float $basePrice): self{$this->basePrice = $basePrice;return $this;}public function getCatalog(): ?Catalog{return $this->catalog;}public function setCatalog(?Catalog $catalog): self{$this->catalog = $catalog;return $this;}/*** @return Collection<int, LicenseStatus>*/public function getLicenseStatuses(): Collection{return $this->licenseStatuses;}public function addLicenseStatus(LicenseStatus $licenseStatus): self{if (!$this->licenseStatuses->contains($licenseStatus)) {$this->licenseStatuses->add($licenseStatus);$licenseStatus->setCourseLicense($this);}return $this;}public function removeLicenseStatus(LicenseStatus $licenseStatus): self{if ($this->licenseStatuses->removeElement($licenseStatus)) {// set the owning side to null (unless already changed)if ($licenseStatus->getCourseLicense() === $this) {$licenseStatus->setCourseLicense(null);}}return $this;}/*** @return Collection<int, CorporationDiscount>*/public function getCorporationDiscounts(): Collection{return $this->corporationDiscounts;}public function addCorporationDiscount(CorporationDiscount $corporationDiscount): self{if (!$this->corporationDiscounts->contains($corporationDiscount)) {$this->corporationDiscounts->add($corporationDiscount);$corporationDiscount->setCourseLicense($this);}return $this;}public function removeCorporationDiscount(CorporationDiscount $corporationDiscount): self{if ($this->corporationDiscounts->removeElement($corporationDiscount)) {// set the owning side to null (unless already changed)if ($corporationDiscount->getCourseLicense() === $this) {$corporationDiscount->setCourseLicense(null);}}return $this;}/*** @return Collection<int, AddOn>*/public function getAddOns(): Collection{return $this->addOns;}public function addAddOn(AddOn $addOn): self{if (!$this->addOns->contains($addOn)) {$this->addOns->add($addOn);$addOn->setCourse($this);}return $this;}public function removeAddOn(AddOn $addOn): self{if ($this->addOns->removeElement($addOn)) {// set the owning side to null (unless already changed)if ($addOn->getCourse() === $this) {$addOn->setCourse(null);}}return $this;}}