<?php declare(strict_types=1);
namespace App\Entity\Core;
use App\Entity\Core\Quiz\QuizSession;
use App\Entity\User\User;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
#[ORM\Table('shared_quiz_extra_teacher')]
#[UniqueConstraint(name: 'unique_session_teacher', columns: ['quiz_session', 'teacher'])]
#[ORM\Entity(repositoryClass: SharedQuizExtraTeacherRepository::class)]
class SharedQuizExtraTeacher
{
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private int $id;
/**
* @var User
*/
#[ORM\JoinColumn(name: 'teacher', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: User::class)]
private User $teacher;
/**
* @var QuizSession
*/
#[ORM\JoinColumn(name: 'quiz_session', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: QuizSession::class)]
private QuizSession $quizSession;
/**
* This is the same as QuizSession->isPinned, but for this particular extra teacher, since it would be strange for
* different teachers to share the same pinned/unpinned state.
*/
#[ORM\Column(name: 'is_pinned', type: 'boolean', options: ['default' => false])]
private bool $isPinned = false;
public function getId(): int
{
return $this->id;
}
public function setId(int $id): void
{
$this->id = $id;
}
public function getTeacher(): User
{
return $this->teacher;
}
public function setTeacher(User $teacher): void
{
$this->teacher = $teacher;
}
public function getQuizSession(): QuizSession
{
return $this->quizSession;
}
public function setQuizSession(QuizSession $quizSession): void
{
$this->quizSession = $quizSession;
}
public function isPinned(): bool
{
return $this->isPinned;
}
public function setIsPinned(bool $isPinned): void
{
$this->isPinned = $isPinned;
}
}