<?php
namespace App\Entity\Core\ReadingTest;
use App\Entity\Core\Answer;
use App\Entity\Core\Mathproblem;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table('reading_test_response')]
#[ORM\Entity(repositoryClass: ReadingTestResponseRepository::class)]
class ReadingTestResponse
{
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
/**
* @var ReadingTestUnit
*/
#[ORM\JoinColumn(name: 'reading_test_unit', referencedColumnName: 'id', onDelete: 'CASCADE')]
#[ORM\ManyToOne(targetEntity: ReadingTestUnit::class, inversedBy: 'readingTestResponses')]
private $readingTestUnit;
/**
* @var ReadingTest
*/
#[ORM\JoinColumn(name: 'readingTest', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: ReadingTest::class)]
private $readingTest;
/**
* @var Mathproblem
*/
#[ORM\JoinColumn(name: 'mathproblem', referencedColumnName: 'id', onDelete: 'CASCADE')]
#[ORM\ManyToOne(targetEntity: Mathproblem::class)]
private $mathproblem;
/**
* @var Answer
*/
#[ORM\JoinColumn(name: 'answer', referencedColumnName: 'id', onDelete: 'RESTRICT')]
#[ORM\ManyToOne(targetEntity: Answer::class)]
private $answerChosen;
/**
* @var DateTime
*/
#[ORM\Column(name: 'createdAt', type: 'datetime', nullable: true)]
private $createdAt;
/**
* @var string
*/
#[ORM\Column(name: 'answer_text', type: 'text', nullable: true)]
private $answerText;
/**
* @var int
*/
#[ORM\Column(name: 'position', type: 'integer')]
private $position;
public function getId(): int
{
return $this->id;
}
public function setId(int $id): void
{
$this->id = $id;
}
public function getReadingTestUnit(): ReadingTestUnit
{
return $this->readingTestUnit;
}
public function setReadingTestUnit(ReadingTestUnit $readingTestUnit): void
{
$this->readingTestUnit = $readingTestUnit;
}
public function getReadingTest(): ReadingTest
{
return $this->readingTest;
}
public function setReadingTest(ReadingTest $readingTest): void
{
$this->readingTest = $readingTest;
}
public function getMathproblem(): Mathproblem
{
return $this->mathproblem;
}
public function setMathproblem(Mathproblem $mathproblem): void
{
$this->mathproblem = $mathproblem;
}
/**
* @return Answer
*/
public function getAnswerChosen()
{
return $this->answerChosen;
}
/**
* @param Answer $answerChosen
* @return $this
*/
public function setAnswerChosen($answerChosen)
{
$this->answerChosen = $answerChosen;
$this->createdAt = new DateTime("now");
return $this;
}
/**
* @return DateTime
*/
public function getCreatedAt(): ?DateTime
{
return $this->createdAt;
}
/**
* @param DateTime $createdAt
*/
public function setCreatedAt(?DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}
public function getAnswerText(): string
{
return $this->answerText;
}
public function setAnswerText(string $answerText): void
{
$this->answerText = $answerText;
}
/**
* @return int
*/
public function getPosition()
{
return $this->position;
}
/**
* @param int $position
* @return $this
*/
public function setPosition($position)
{
$this->position = $position;
return $this;
}
}