src/Entity/Core/Textbook/TextbookCategory.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\Textbook;
  3. use Doctrine\ORM\Mapping as ORM;
  4. #[ORM\Table('textbook_category')]
  5. #[ORM\Entity(repositoryClass: TextbookCategoryRepository::class)]
  6. class TextbookCategory
  7. {
  8. /**
  9. * @var int
  10. */
  11. #[ORM\Column(name: 'id', type: 'integer')]
  12. #[ORM\Id]
  13. #[ORM\GeneratedValue(strategy: 'AUTO')]
  14. private $id;
  15. /**
  16. * @var int
  17. */
  18. #[ORM\Column(name: 'sortorder', type: 'integer')]
  19. private $order;
  20. /**
  21. * @var bool
  22. */
  23. #[ORM\Column(name: 'is_enabled', type: 'boolean', options: ['default' => true])]
  24. private $enabled;
  25. /**
  26. * @var string
  27. */
  28. #[ORM\Column(name: 'name', type: 'string', length: 255)]
  29. private $name;
  30. // TODO this will be deleted after migration to $textbook is done
  31. /**
  32. * @var string
  33. */
  34. #[ORM\Column(name: 'curriculum', type: 'string', length: 16)]
  35. private $curriculum;
  36. /**
  37. * @var $textbook
  38. */
  39. #[ORM\JoinColumn(name: 'textbook', referencedColumnName: 'id')]
  40. #[ORM\ManyToOne(targetEntity: Textbook::class)]
  41. private $textbook;
  42. /**
  43. * @var TextbookTopic[]
  44. */
  45. #[ORM\OneToMany(targetEntity: TextbookTopic::class, mappedBy: 'textbookCategory', cascade: ['persist'])]
  46. private $textbookTopics;
  47. public function getId(): int
  48. {
  49. return $this->id;
  50. }
  51. /**
  52. * @return string
  53. */
  54. public function getName()
  55. {
  56. return $this->name;
  57. }
  58. /**
  59. * @return int
  60. */
  61. public function getOrder()
  62. {
  63. return $this->order;
  64. }
  65. /**
  66. * @return TextbookTopic[]
  67. */
  68. public function getTextbookTopics()
  69. {
  70. return $this->textbookTopics;
  71. }
  72. public function isEnabled(): bool
  73. {
  74. return $this->enabled;
  75. }
  76. public function setEnabled(bool $enabled): void
  77. {
  78. $this->enabled = $enabled;
  79. }
  80. public function getCurriculum(): string
  81. {
  82. return $this->curriculum;
  83. }
  84. public function getTextbook(): Textbook
  85. {
  86. return $this->textbook;
  87. }
  88. }