src/Entity/Catalog.php line 16
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\CatalogRepository;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: CatalogRepository::class)]#[Broadcast]#[ApiResource]class Catalog{#[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\ManyToOne(inversedBy: 'catalogs')]private ?Portal $portal = null;#[ORM\ManyToMany(targetEntity: Course::class, mappedBy: 'catalog')]private Collection $courses;#[ORM\OneToMany(mappedBy: 'catalog', targetEntity: CourseLicense::class)]private Collection $courseLicenses;public function __construct(){$this->courses = new ArrayCollection();$this->setDescription('Beschreibung');$this->courseLicenses = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function __toString(): string{return $this->name;}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;}public function getPortal(): ?Portal{return $this->portal;}public function setPortal(?Portal $portal): self{$this->portal = $portal;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);$course->addCatalog($this);}return $this;}public function removeCourse(Course $course): self{if ($this->courses->removeElement($course)) {$course->removeCatalog($this);}return $this;}/*** @return Collection<int, CourseLicense>*/public function getCourseLicenses(): Collection{return $this->courseLicenses;}public function addCourseLicense(CourseLicense $courseLicense): self{if (!$this->courseLicenses->contains($courseLicense)) {$this->courseLicenses->add($courseLicense);$courseLicense->setCatalog($this);}return $this;}public function removeCourseLicense(CourseLicense $courseLicense): self{if ($this->courseLicenses->removeElement($courseLicense)) {// set the owning side to null (unless already changed)if ($courseLicense->getCatalog() === $this) {$courseLicense->setCatalog(null);}}return $this;}}