src/Entity/Core/SelfStudy/SelfStudyTopic.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\SelfStudy;
  3. use App\Entity\Core\Quiz\Quiz;
  4. use App\Entity\Core\Topic\Topic;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JsonSerializable;
  7. #[ORM\Table('self_study_topic')]
  8. #[ORM\Entity]
  9. class SelfStudyTopic implements JsonSerializable
  10. {
  11. /**
  12. * @var int
  13. */
  14. #[ORM\Column(name: 'id', type: 'integer')]
  15. #[ORM\Id]
  16. #[ORM\GeneratedValue(strategy: 'AUTO')]
  17. private $id;
  18. /**
  19. * @var string
  20. */
  21. #[ORM\Column(name: 'display_name', type: 'string', length: 255)]
  22. private $displayName;
  23. /**
  24. * @var int
  25. */
  26. #[ORM\Column(name: 'sort_order', type: 'integer', nullable: true, options: ['default' => 0])]
  27. private $sortOrder;
  28. /**
  29. * @var string
  30. */
  31. #[ORM\Column(name: 'teaser', type: 'string', length: 3000, nullable: true)]
  32. private $teaser;
  33. /**
  34. * @var SelfStudyCategory
  35. */
  36. #[ORM\JoinColumn(name: 'self_study_category', referencedColumnName: 'id')]
  37. #[ORM\ManyToOne(targetEntity: SelfStudyCategory::class, inversedBy: 'selfStudyTopics')]
  38. private $selfStudyCategory;
  39. /**
  40. * @var Topic
  41. */
  42. #[ORM\JoinColumn(name: 'topic', referencedColumnName: 'id')]
  43. #[ORM\ManyToOne(targetEntity: Topic::class)]
  44. private $topic;
  45. /**
  46. * @var Quiz
  47. */
  48. #[ORM\JoinColumn(name: 'quiz', referencedColumnName: 'id')]
  49. #[ORM\ManyToOne(targetEntity: Quiz::class)]
  50. private $quiz;
  51. public function getId(): int
  52. {
  53. return $this->id;
  54. }
  55. public function getDisplayName(): string
  56. {
  57. return $this->displayName;
  58. }
  59. public function getSelfStudyCategory(): SelfStudyCategory
  60. {
  61. return $this->selfStudyCategory;
  62. }
  63. public function getTopic(): Topic
  64. {
  65. return $this->topic;
  66. }
  67. public function getSortOrder(): int
  68. {
  69. return $this->sortOrder;
  70. }
  71. public function getTeaser(): ?string
  72. {
  73. return $this->teaser;
  74. }
  75. public function getQuiz(): ?Quiz
  76. {
  77. return $this->quiz;
  78. }
  79. public function jsonSerialize(): mixed
  80. {
  81. return [
  82. "id" => $this->getId(),
  83. "displayName" => $this->getDisplayName(),
  84. ];
  85. }
  86. }