<?php
namespace App\Entity\Core\SelfStudy;
use App\Entity\Core\Quiz\Quiz;
use App\Entity\Core\Topic\Topic;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
#[ORM\Table('self_study_topic')]
#[ORM\Entity]
class SelfStudyTopic implements JsonSerializable
{
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
/**
* @var string
*/
#[ORM\Column(name: 'display_name', type: 'string', length: 255)]
private $displayName;
/**
* @var int
*/
#[ORM\Column(name: 'sort_order', type: 'integer', nullable: true, options: ['default' => 0])]
private $sortOrder;
/**
* @var string
*/
#[ORM\Column(name: 'teaser', type: 'string', length: 3000, nullable: true)]
private $teaser;
/**
* @var SelfStudyCategory
*/
#[ORM\JoinColumn(name: 'self_study_category', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: SelfStudyCategory::class, inversedBy: 'selfStudyTopics')]
private $selfStudyCategory;
/**
* @var Topic
*/
#[ORM\JoinColumn(name: 'topic', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: Topic::class)]
private $topic;
/**
* @var Quiz
*/
#[ORM\JoinColumn(name: 'quiz', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: Quiz::class)]
private $quiz;
public function getId(): int
{
return $this->id;
}
public function getDisplayName(): string
{
return $this->displayName;
}
public function getSelfStudyCategory(): SelfStudyCategory
{
return $this->selfStudyCategory;
}
public function getTopic(): Topic
{
return $this->topic;
}
public function getSortOrder(): int
{
return $this->sortOrder;
}
public function getTeaser(): ?string
{
return $this->teaser;
}
public function getQuiz(): ?Quiz
{
return $this->quiz;
}
public function jsonSerialize(): mixed
{
return [
"id" => $this->getId(),
"displayName" => $this->getDisplayName(),
];
}
}