<?php
namespace App\Entity\Core\Session;
use App\Entity\Core\Homework\Homework;
use App\Entity\User\User;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table('session_student_difficulty')]
#[ORM\Entity]
class SessionStudentDifficulty
{
const DEFAULT_DIFFICULTY = 3;
const TYPE_TRAINING = 1;
CONST TYPE_HOMEWORK = 2;
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
/**
* @var User
*/
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: User::class, fetch: 'EAGER')]
private $student;
/**
* 1 - training
* 2 - homework
*/
#[ORM\Column(name: 'type', type: 'integer')]
private $type;
/**
* @var Session
*/
#[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]
#[ORM\ManyToOne(targetEntity: Session::class)]
private $session;
/**
* @var Homework
*/
#[ORM\JoinColumn(name: 'homework_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]
#[ORM\ManyToOne(targetEntity: Homework::class)]
private $homework;
#[ORM\Column(name: 'difficulty', type: 'integer')]
private $difficulty = self::DEFAULT_DIFFICULTY;
#[ORM\Column(name: 'consecutive_correct_answers', type: 'integer')]
private $consecutiveCorrectAnswers = 0;
#[ORM\Column(name: 'repetition_flag', type: 'smallint', nullable: true, options: ['default' => 0])]
private $repetitionFlag = 0;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
public function getStudent(): User
{
return $this->student;
}
public function setStudent(User $student): void
{
$this->student = $student;
}
/**
* @return mixed
*/
public function getType()
{
return $this->type;
}
/**
* @param mixed $type
*/
public function setType($type): void
{
$this->type = $type;
}
public function getSession(): Session
{
return $this->session;
}
public function setSession(Session $session): void
{
$this->session = $session;
}
public function getHomework(): Homework
{
return $this->homework;
}
public function setHomework(Homework $homework): void
{
$this->homework = $homework;
}
public function getDifficulty(): int
{
return $this->difficulty;
}
public function setDifficulty(int $difficulty): void
{
$this->difficulty = $difficulty;
}
public function getConsecutiveCorrectAnswers(): int
{
return $this->consecutiveCorrectAnswers;
}
public function setConsecutiveCorrectAnswers(int $consecutiveCorrectAnswers): void
{
$this->consecutiveCorrectAnswers = $consecutiveCorrectAnswers;
}
public function getRepetitionFlag(): int
{
return $this->repetitionFlag;
}
public function setRepetitionFlag(int $repetitionFlag): void
{
$this->repetitionFlag = $repetitionFlag;
}
}