<?php
namespace CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use UserBundle\Entity\User;
use JsonSerializable;
/**
* @ORM\Table("pretest_response")
* @ORM\Entity(repositoryClass="CoreBundle\Entity\PretestResponseRepository")
*/
class PretestResponse implements JsonSerializable
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $student;
/**
* @var Session
*
* @ORM\ManyToOne(targetEntity="CoreBundle\Entity\Session", inversedBy="PretestResponses")
* @ORM\JoinColumn(name="session", referencedColumnName="id", onDelete="CASCADE")
*/
private $session;
/**
* @var Mathproblem
*
* @ORM\ManyToOne(targetEntity="Mathproblem",fetch="EAGER")
* @ORM\JoinColumn(name="mathproblem", referencedColumnName="id")
*/
private $mathproblem;
/**
* @var Answer
*
* @ORM\ManyToOne(targetEntity="CoreBundle\Entity\Answer",fetch="EAGER")
* @ORM\JoinColumn(name="answer", referencedColumnName="id", nullable=true, onDelete="RESTRICT")
*/
private $answer;
/**
* @var string
* @ORM\Column(name="answerTxt", type="string", nullable=true)
*/
private $answerTxt;
/**
* @var \DateTime
*
* @ORM\Column(name="endTime", type="datetime", nullable=true)
*/
private $endTime = null;
/**
* @var \DateTime
*
* @ORM\Column(name="startTime", type="datetime")
*/
private $startTime;
/**
* @var decimal $currentElo
*
* @ORM\Column(name="elo", type="decimal",precision=9,scale=5, unique=false, nullable=true)
*/
private $currentElo;
/**
* @var decimal $currentEloMP
*
* @ORM\Column(name="elo_mp", type="decimal",precision=9,scale=5, unique=false, nullable=true)
*/
private $currentEloMP;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set student.
*
* @param User $student
*
* @return PretestResponse
*/
public function setStudent($student)
{
$this->student = $student;
return $this;
}
/**
* Get student.
*
* @return User
*/
public function getStudent()
{
return $this->student;
}
/**
* Set Session.
*
* @param Session $session
*
* @return PretestResponse
*/
public function setSession($session)
{
$this->session = $session;
return $this;
}
/**
* Get Session.
*
* @return Session
*/
public function getSession()
{
return $this->session;
}
/**
* Set mathproblem.
*
* @param Mathproblem $mathproblem
*
* @return PretestResponse
*/
public function setMathproblem($mathproblem)
{
$this->mathproblem = $mathproblem;
return $this;
}
/**
* Get Mathproblem.
*
* @return Mathproblem
*/
public function getMathproblem()
{
return $this->mathproblem;
}
/**
* Set answer.
*
* @param Answer $answer
*
* @return PretestResponse
*/
public function setAnswer($answer)
{
$this->answer = $answer;
return $this;
}
/**
* @return Answer
*/
public function getAnswerChosen()
{
return $this->answer;
}
/**
* Set answer.
*
* @param string
*
* @return PretestResponse
*/
public function setAnswerTxt($answer)
{
$this->answerTxt = $answer;
return $this;
}
/**
* Get answerTxt.
*
* @return string
*/
public function getAnswerTxt()
{
return $this->answerTxt;
}
/**
* Get answer.
*
* @return Answer
*/
public function getAnswer()
{
return $this->answer;
}
/**
* @param \DateTime $endTime
*/
public function setEndTime($endTime)
{
$this->endTime = $endTime;
}
/**
* @return \DateTime
*/
public function getEndTime()
{
return $this->endTime;
}
/**
* @param \DateTime $startTime
*/
public function setStartTime($startTime)
{
$this->startTime = $startTime;
}
/**
* @return \DateTime
*/
public function getStartTime()
{
return $this->startTime;
}
/**
* @return decimal
*/
public function getCurrentElo()
{
return $this->currentElo;
}
/**
* @param decimal $elo
*/
public function setCurrentElo($elo)
{
$this->currentElo = $elo;
}
/**
* @return decimal
*/
public function getCurrentEloMP()
{
return $this->currentEloMP;
}
/**
* @param decimal $elo
*/
public function setCurrentEloMP($elo)
{
$this->currentEloMP = $elo;
}
public function jsonSerialize(): mixed
{
return [
"id" => $this->getId(),
"startTime" => $this->getStartTime(),
"session" => $this->getSession(),
"answerChosen" => $this->getAnswerChosen(),
"mathproblem" => $this->getMathproblem(),
"answer" => $this->getAnswer(),
"student" => $this->getStudent(),
"endTime" => $this->getEndTime(),
"answerTxt" => $this->getAnswerTxt(),
"currentElo" => $this->getCurrentElo(),
"currentEloMP" => $this->getCurrentEloMP(),
];
}
}