src/Entity/Core/Session/SessionStudentDifficulty.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Core\Session;
  3. use App\Entity\Core\Homework\Homework;
  4. use App\Entity\User\User;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Table('session_student_difficulty')]
  7. #[ORM\Entity]
  8. class SessionStudentDifficulty
  9. {
  10. const DEFAULT_DIFFICULTY = 3;
  11. const TYPE_TRAINING = 1;
  12. CONST TYPE_HOMEWORK = 2;
  13. /**
  14. * @var int
  15. */
  16. #[ORM\Column(name: 'id', type: 'integer')]
  17. #[ORM\Id]
  18. #[ORM\GeneratedValue(strategy: 'AUTO')]
  19. private $id;
  20. /**
  21. * @var User
  22. */
  23. #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
  24. #[ORM\ManyToOne(targetEntity: User::class, fetch: 'EAGER')]
  25. private $student;
  26. /**
  27. * 1 - training
  28. * 2 - homework
  29. */
  30. #[ORM\Column(name: 'type', type: 'integer')]
  31. private $type;
  32. /**
  33. * @var Session
  34. */
  35. #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]
  36. #[ORM\ManyToOne(targetEntity: Session::class)]
  37. private $session;
  38. /**
  39. * @var Homework
  40. */
  41. #[ORM\JoinColumn(name: 'homework_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]
  42. #[ORM\ManyToOne(targetEntity: Homework::class)]
  43. private $homework;
  44. #[ORM\Column(name: 'difficulty', type: 'integer')]
  45. private $difficulty = self::DEFAULT_DIFFICULTY;
  46. #[ORM\Column(name: 'consecutive_correct_answers', type: 'integer')]
  47. private $consecutiveCorrectAnswers = 0;
  48. #[ORM\Column(name: 'repetition_flag', type: 'smallint', nullable: true, options: ['default' => 0])]
  49. private $repetitionFlag = 0;
  50. /**
  51. * Get id.
  52. *
  53. * @return int
  54. */
  55. public function getId()
  56. {
  57. return $this->id;
  58. }
  59. public function getStudent(): User
  60. {
  61. return $this->student;
  62. }
  63. public function setStudent(User $student): void
  64. {
  65. $this->student = $student;
  66. }
  67. /**
  68. * @return mixed
  69. */
  70. public function getType()
  71. {
  72. return $this->type;
  73. }
  74. /**
  75. * @param mixed $type
  76. */
  77. public function setType($type): void
  78. {
  79. $this->type = $type;
  80. }
  81. public function getSession(): Session
  82. {
  83. return $this->session;
  84. }
  85. public function setSession(Session $session): void
  86. {
  87. $this->session = $session;
  88. }
  89. public function getHomework(): Homework
  90. {
  91. return $this->homework;
  92. }
  93. public function setHomework(Homework $homework): void
  94. {
  95. $this->homework = $homework;
  96. }
  97. public function getDifficulty(): int
  98. {
  99. return $this->difficulty;
  100. }
  101. public function setDifficulty(int $difficulty): void
  102. {
  103. $this->difficulty = $difficulty;
  104. }
  105. public function getConsecutiveCorrectAnswers(): int
  106. {
  107. return $this->consecutiveCorrectAnswers;
  108. }
  109. public function setConsecutiveCorrectAnswers(int $consecutiveCorrectAnswers): void
  110. {
  111. $this->consecutiveCorrectAnswers = $consecutiveCorrectAnswers;
  112. }
  113. public function getRepetitionFlag(): int
  114. {
  115. return $this->repetitionFlag;
  116. }
  117. public function setRepetitionFlag(int $repetitionFlag): void
  118. {
  119. $this->repetitionFlag = $repetitionFlag;
  120. }
  121. }