src/Entity/Core/Textbook/TextbookTopic.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\Textbook;
  3. use App\Entity\Core\Topic\Topic;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Table('textbook_topic')]
  6. #[ORM\Entity(repositoryClass: TextbookTopicRepository::class)]
  7. class TextbookTopic
  8. {
  9. /**
  10. * @var int
  11. */
  12. #[ORM\Column(name: 'id', type: 'integer')]
  13. #[ORM\Id]
  14. #[ORM\GeneratedValue(strategy: 'AUTO')]
  15. private $id;
  16. /**
  17. * @var int
  18. */
  19. #[ORM\Column(name: 'sortorder', type: 'integer')]
  20. private $order;
  21. /**
  22. * @var string
  23. */
  24. #[ORM\Column(name: 'name', type: 'string', length: 255)]
  25. private $name;
  26. #[ORM\JoinTable(name: 'topics_textbook_topics')]
  27. #[ORM\JoinColumn(name: 'textbook_topic_id', referencedColumnName: 'id')]
  28. #[ORM\InverseJoinColumn(name: 'topic_id', referencedColumnName: 'id')]
  29. #[ORM\ManyToMany(targetEntity: Topic::class)]
  30. private $topics;
  31. /**
  32. * @var TextbookCategory
  33. */
  34. #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')]
  35. #[ORM\ManyToOne(targetEntity: TextbookCategory::class, inversedBy: 'textbookTopics')]
  36. private $textbookCategory;
  37. /**
  38. * @var TextbookSubTopic[]
  39. */
  40. #[ORM\OneToMany(targetEntity: TextbookSubTopic::class, mappedBy: 'textbookTopic', cascade: ['persist'])]
  41. private $textbookSubTopics;
  42. /**
  43. * @return int
  44. */
  45. public function getOrder()
  46. {
  47. return $this->order;
  48. }
  49. /**
  50. * @return string
  51. */
  52. public function getName()
  53. {
  54. return $this->name;
  55. }
  56. /**
  57. * @return TextbookCategory
  58. */
  59. public function getTextbookCategory()
  60. {
  61. return $this->textbookCategory;
  62. }
  63. /**
  64. * @return TextbookSubTopic[]
  65. */
  66. public function getTextbookSubTopics()
  67. {
  68. return $this->textbookSubTopics;
  69. }
  70. public function getId(): int
  71. {
  72. return $this->id;
  73. }
  74. }