src/CoreBundle/Entity/TextbookSession.php line 13

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use JsonSerializable;
  6. /**
  7. * @ORM\Table("textbook_session")
  8. * @ORM\Entity(repositoryClass="TextbookSessionRepository")
  9. */
  10. class TextbookSession implements JsonSerializable
  11. {
  12. /**
  13. * @var int
  14. *
  15. * @ORM\Column(name="id", type="integer")
  16. * @ORM\Id
  17. * @ORM\GeneratedValue(strategy="AUTO")
  18. */
  19. private $id;
  20. /**
  21. * @var Classroom
  22. *
  23. * @ORM\ManyToOne(targetEntity="Classroom", inversedBy="sessions")
  24. * @ORM\JoinColumn(name="classroom", referencedColumnName="id", onDelete="CASCADE")
  25. */
  26. private $classroom;
  27. /**
  28. * @var ArrayCollection|TextbookSubTopic[]
  29. *
  30. * @ORM\ManyToMany(targetEntity="TextbookSubTopic", inversedBy="textbookSessions")
  31. * @ORM\JoinTable(name="textbook_session_subtopic",
  32. * joinColumns={@ORM\JoinColumn(name="textbook_session", referencedColumnName="id")},
  33. * inverseJoinColumns={@ORM\JoinColumn(name="subtopic", referencedColumnName="id")})
  34. */
  35. private $textbookSubtopics;
  36. /**
  37. * @var \DateTime
  38. *
  39. * @ORM\Column(name="start_time", type="datetime", nullable=true)
  40. */
  41. private $startTime;
  42. /**
  43. *
  44. * @ORM\Column(name="deadline", type="datetime")
  45. */
  46. private $deadline;
  47. /**
  48. * @ORM\Column(type="string", nullable=true)
  49. */
  50. private $name;
  51. /**
  52. * @ORM\Column(type="text", nullable=true)
  53. */
  54. private $notice;
  55. /**
  56. * @var TextbookSessionUnit[]
  57. *
  58. * @ORM\OneToMany(targetEntity="CoreBundle\Entity\TextbookSessionUnit", mappedBy="session", cascade={"persist"})
  59. */
  60. private $units;
  61. /**
  62. * @var integer
  63. *
  64. * @ORM\Column(type="integer", nullable=false, options={"default"=1})
  65. */
  66. private $isEnabled = 1;
  67. /**
  68. * @return Classroom
  69. */
  70. public function getClassroom()
  71. {
  72. return $this->classroom;
  73. }
  74. /**
  75. * @param Classroom $classroom
  76. */
  77. public function setClassroom($classroom)
  78. {
  79. $this->classroom = $classroom;
  80. }
  81. /**
  82. * @return \DateTime
  83. */
  84. public function getStartTime()
  85. {
  86. return $this->startTime;
  87. }
  88. /**
  89. * @param \DateTime $startTime
  90. */
  91. public function setStartTime($startTime)
  92. {
  93. $this->startTime = $startTime;
  94. }
  95. /**
  96. * @return \DateTime
  97. */
  98. public function getDeadline()
  99. {
  100. return $this->deadline;
  101. }
  102. /**
  103. * @param \DateTime $deadline
  104. */
  105. public function setDeadline($deadline)
  106. {
  107. $this->deadline = $deadline;
  108. }
  109. /**
  110. * @return mixed
  111. */
  112. public function getName()
  113. {
  114. return $this->name;
  115. }
  116. /**
  117. * @param mixed $name
  118. */
  119. public function setName($name)
  120. {
  121. $this->name = $name;
  122. }
  123. /**
  124. * @return int
  125. */
  126. public function getId()
  127. {
  128. return $this->id;
  129. }
  130. /**
  131. *
  132. */
  133. public function resetId()
  134. {
  135. $this->id = null;
  136. }
  137. /**
  138. * @return TextbookSubTopic[]|ArrayCollection
  139. */
  140. public function getTextbookSubtopics()
  141. {
  142. return $this->textbookSubtopics;
  143. }
  144. /**
  145. * @param TextbookSubTopic[]|ArrayCollection $textbookSubtopics
  146. */
  147. public function setTextbookSubtopics($textbookSubtopics)
  148. {
  149. $this->textbookSubtopics = $textbookSubtopics;
  150. }
  151. /**
  152. * @return TextbookSessionUnit[]
  153. */
  154. public function getUnits()
  155. {
  156. return $this->units;
  157. }
  158. /**
  159. * @param TextbookSessionUnit[] $units
  160. */
  161. public function setUnits($units)
  162. {
  163. $this->units = $units;
  164. }
  165. public function getNotice(): ?string
  166. {
  167. return $this->notice;
  168. }
  169. public function setNotice(?String $notice)
  170. {
  171. $this->notice = $notice;
  172. }
  173. /**
  174. * @return int
  175. */
  176. public function getisEnabled(): int
  177. {
  178. return $this->isEnabled;
  179. }
  180. /**
  181. * @param int $isEnabled
  182. */
  183. public function setIsEnabled(int $isEnabled): void
  184. {
  185. $this->isEnabled = $isEnabled;
  186. }
  187. public function jsonSerialize(): mixed
  188. {
  189. return [
  190. "id" => $this->getId(),
  191. "name" => $this->getName(),
  192. "startTime" => $this->getStartTime(),
  193. ];
  194. }
  195. }