src/CoreBundle/Entity/TextbookSessionUnit.php line 14

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use UserBundle\Entity\User;
  5. /**
  6. * link the session with the students
  7. * @ORM\Table("textbook_session_unit")
  8. * @ORM\Entity(repositoryClass="CoreBundle\Entity\TextbookSessionUnitRepository")
  9. */
  10. class TextbookSessionUnit
  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 User
  22. *
  23. * @ORM\ManyToOne(targetEntity="UserBundle\Entity\User")
  24. * @ORM\JoinColumn(name="student", referencedColumnName="id")
  25. */
  26. private $student;
  27. /**
  28. * @var TextbookSession
  29. *
  30. * @ORM\ManyToOne(targetEntity="CoreBundle\Entity\TextbookSession", inversedBy="units")
  31. * @ORM\JoinColumn(name="session", referencedColumnName="id", onDelete="CASCADE")
  32. */
  33. private $session;
  34. /**
  35. * @var bool
  36. *
  37. * @ORM\Column(type="boolean", nullable=true, options={"default": null})
  38. */
  39. private $finished = null;
  40. /**
  41. * @var \DateTime
  42. *
  43. * @ORM\Column(name="extended_deadline", type="datetime", nullable=true)
  44. */
  45. private $extendedDeadline;
  46. public function __construct($student, $session)
  47. {
  48. $this->student = $student;
  49. $this->session = $session;
  50. $this->finished = false;
  51. }
  52. public function getStudent(): User
  53. {
  54. return $this->student;
  55. }
  56. public function isFinished(): ?bool
  57. {
  58. return $this->finished;
  59. }
  60. public function setFinished(bool $finished)
  61. {
  62. $this->finished = $finished;
  63. }
  64. /**
  65. * @return \DateTime|null
  66. */
  67. public function getExtendedDeadline(): ?\DateTime
  68. {
  69. return $this->extendedDeadline;
  70. }
  71. /**
  72. * @param \DateTime $extendedDeadline
  73. */
  74. public function setExtendedDeadline(\DateTime $extendedDeadline): void
  75. {
  76. $this->extendedDeadline = $extendedDeadline;
  77. }
  78. }