src/Entity/Core/SelfStudy/SelfStudyTypicalExamProblem.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\SelfStudy;
  3. use App\Entity\Core\Quiz\Quiz;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Table('self_study_typical_exam_problem')]
  8. #[ORM\Entity(repositoryClass: SelfStudyTypicalExamProblemRepository::class)]
  9. class SelfStudyTypicalExamProblem
  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: 'name', type: 'string')]
  22. private $name;
  23. /**
  24. * @var ArrayCollection|SelfStudy[]
  25. */
  26. #[ORM\JoinTable(name: 'relation_self_study_typical_exam_problem')]
  27. #[ORM\JoinColumn(name: 'typical_exam_problem_id', referencedColumnName: 'id')]
  28. #[ORM\InverseJoinColumn(name: 'self_study_id', referencedColumnName: 'id')]
  29. #[ORM\ManyToMany(targetEntity: SelfStudy::class, inversedBy: 'typicalExamProblems')]
  30. private $selfStudyList;
  31. /**
  32. * @var SelfStudyTypicalExamProblemElement[]
  33. */
  34. #[ORM\OneToMany(targetEntity: SelfStudyTypicalExamProblemElement::class, mappedBy: 'problem', cascade: ['persist'])]
  35. private $elements;
  36. /**
  37. * @var Quiz
  38. */
  39. #[ORM\JoinColumn(name: 'quiz', referencedColumnName: 'id')]
  40. #[ORM\ManyToOne(targetEntity: Quiz::class)]
  41. private $quiz;
  42. /**
  43. * @var bool
  44. */
  45. #[ORM\Column(name: 'has_color', type: 'boolean', options: ['default' => false])]
  46. private $hasColor;
  47. /**
  48. * @var int
  49. */
  50. #[ORM\Column(name: 'sort_order', type: 'integer', options: ['default' => 0])]
  51. private $sortOrder = 0;
  52. public function __construct()
  53. {
  54. $this->selfStudyList = new ArrayCollection();
  55. $this->elements = new ArrayCollection();
  56. }
  57. /**
  58. * @return int
  59. */
  60. public function getId()
  61. {
  62. return $this->id;
  63. }
  64. public function __toString(): string
  65. {
  66. if (!empty($this->name)) {
  67. return $this->name;
  68. }
  69. return $this->id !== null ? (string) $this->id : 'uden navn';
  70. }
  71. /**
  72. * @return SelfStudyTypicalExamProblemElement[]
  73. */
  74. public function getElements(): Collection
  75. {
  76. return $this->elements;
  77. }
  78. public function getSelfStudyList(): Collection
  79. {
  80. return $this->selfStudyList;
  81. }
  82. public function getName(): string
  83. {
  84. return $this->name;
  85. }
  86. public function setName(string $name): void
  87. {
  88. $this->name = $name;
  89. }
  90. public function getQuiz(): ?Quiz
  91. {
  92. return $this->quiz;
  93. }
  94. public function setQuiz(?Quiz $quiz): void
  95. {
  96. $this->quiz = $quiz;
  97. }
  98. public function hasColor(): bool
  99. {
  100. return $this->hasColor;
  101. }
  102. public function setHasColor(bool $hasColor): void
  103. {
  104. $this->hasColor = $hasColor;
  105. }
  106. public function getSortOrder(): int
  107. {
  108. return $this->sortOrder;
  109. }
  110. public function setSortOrder(int $sortOrder): void
  111. {
  112. $this->sortOrder = $sortOrder;
  113. }
  114. }