<?php
namespace App\Entity;
use App\Repository\AnswerRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=AnswerRepository::class)
* @ORM\Table(name="app_answer")
*/
class Answer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private int $id;
/**
* Текст ответа
* @ORM\Column(type="string", length=500, nullable=true)
*/
private ?string $text;
/**
* Текст ответа
* @ORM\Column(type="string", length=500, nullable=true)
*/
private ?string $textLocal;
/**
* Может ли этот ответ завершать опрос (например, ответ "Нет, мне менее 18" = завершить)
* @ORM\Column(type="boolean", options={"default": false})
*/
private bool $endSurvey = false;
/**
* Правильный ли ответ (если нам нужно тестирование/викторина)
* @ORM\Column(type="boolean", options={"default": false})
*/
private bool $isCorrect = false;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Question", inversedBy="answers")
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private Question $question;
/**
* @ORM\Column(type="integer", options={"default": 0}, nullable=true)
*/
private ?int $score = 0;
public function getId(): int
{
return $this->id;
}
public function __toString(): string
{
return $this->getText();
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getTextLocal(): ?string
{
return $this->textLocal;
}
public function setTextLocal(?string $textLocal): self
{
$this->textLocal = $textLocal;
return $this;
}
public function isEndSurvey(): bool
{
return $this->endSurvey;
}
public function setEndSurvey(bool $endSurvey): self
{
$this->endSurvey = $endSurvey;
return $this;
}
public function isCorrect(): bool
{
return $this->isCorrect;
}
public function setIsCorrect(bool $correct): self
{
$this->isCorrect = $correct;
return $this;
}
public function getQuestion(): Question
{
return $this->question;
}
public function setQuestion(Question $question): self
{
$this->question = $question;
return $this;
}
public function getScore(): ?int
{
return $this->score;
}
public function setScore(?int $score): self
{
$this->score = $score;
return $this;
}
}