src/Entity/Core/SharedQuizExtraTeacher.php line 15

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace App\Entity\Core;
  3. use App\Entity\Core\Quiz\QuizSession;
  4. use App\Entity\User\User;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\ORM\Mapping\UniqueConstraint;
  7. #[ORM\Table('shared_quiz_extra_teacher')]
  8. #[UniqueConstraint(name: 'unique_session_teacher', columns: ['quiz_session', 'teacher'])]
  9. #[ORM\Entity(repositoryClass: SharedQuizExtraTeacherRepository::class)]
  10. class SharedQuizExtraTeacher
  11. {
  12. /**
  13. * @var int
  14. */
  15. #[ORM\Column(name: 'id', type: 'integer')]
  16. #[ORM\Id]
  17. #[ORM\GeneratedValue(strategy: 'AUTO')]
  18. private int $id;
  19. /**
  20. * @var User
  21. */
  22. #[ORM\JoinColumn(name: 'teacher', referencedColumnName: 'id')]
  23. #[ORM\ManyToOne(targetEntity: User::class)]
  24. private User $teacher;
  25. /**
  26. * @var QuizSession
  27. */
  28. #[ORM\JoinColumn(name: 'quiz_session', referencedColumnName: 'id')]
  29. #[ORM\ManyToOne(targetEntity: QuizSession::class)]
  30. private QuizSession $quizSession;
  31. /**
  32. * This is the same as QuizSession->isPinned, but for this particular extra teacher, since it would be strange for
  33. * different teachers to share the same pinned/unpinned state.
  34. */
  35. #[ORM\Column(name: 'is_pinned', type: 'boolean', options: ['default' => false])]
  36. private bool $isPinned = false;
  37. public function getId(): int
  38. {
  39. return $this->id;
  40. }
  41. public function setId(int $id): void
  42. {
  43. $this->id = $id;
  44. }
  45. public function getTeacher(): User
  46. {
  47. return $this->teacher;
  48. }
  49. public function setTeacher(User $teacher): void
  50. {
  51. $this->teacher = $teacher;
  52. }
  53. public function getQuizSession(): QuizSession
  54. {
  55. return $this->quizSession;
  56. }
  57. public function setQuizSession(QuizSession $quizSession): void
  58. {
  59. $this->quizSession = $quizSession;
  60. }
  61. public function isPinned(): bool
  62. {
  63. return $this->isPinned;
  64. }
  65. public function setIsPinned(bool $isPinned): void
  66. {
  67. $this->isPinned = $isPinned;
  68. }
  69. }