src/Entity/Answer.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AnswerRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=AnswerRepository::class)
  7.  * @ORM\Table(name="app_answer")
  8.  */
  9. class Answer
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private int $id;
  17.     /**
  18.      * Текст ответа
  19.      * @ORM\Column(type="string", length=500, nullable=true)
  20.      */
  21.     private ?string $text;
  22.     /**
  23.      * Текст ответа
  24.      * @ORM\Column(type="string", length=500, nullable=true)
  25.      */
  26.     private ?string $textLocal;
  27.     /**
  28.      * Может ли этот ответ завершать опрос (например, ответ "Нет, мне менее 18" = завершить)
  29.      * @ORM\Column(type="boolean", options={"default": false})
  30.      */
  31.     private bool $endSurvey false;
  32.     /**
  33.      * Правильный ли ответ (если нам нужно тестирование/викторина)
  34.      * @ORM\Column(type="boolean", options={"default": false})
  35.      */
  36.     private bool $isCorrect false;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity="App\Entity\Question", inversedBy="answers")
  39.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  40.      */
  41.     private Question $question;
  42.     /**
  43.      * @ORM\Column(type="integer", options={"default": 0}, nullable=true)
  44.      */
  45.     private ?int $score 0;
  46.     public function getId(): int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function __toString(): string
  51.     {
  52.         return $this->getText();
  53.     }
  54.     public function getText(): ?string
  55.     {
  56.         return $this->text;
  57.     }
  58.     public function setText(?string $text): self
  59.     {
  60.         $this->text $text;
  61.         return $this;
  62.     }
  63.     public function getTextLocal(): ?string
  64.     {
  65.         return $this->textLocal;
  66.     }
  67.     public function setTextLocal(?string $textLocal): self
  68.     {
  69.         $this->textLocal $textLocal;
  70.         return $this;
  71.     }
  72.     public function isEndSurvey(): bool
  73.     {
  74.         return $this->endSurvey;
  75.     }
  76.     public function setEndSurvey(bool $endSurvey): self
  77.     {
  78.         $this->endSurvey $endSurvey;
  79.         return $this;
  80.     }
  81.     public function isCorrect(): bool
  82.     {
  83.         return $this->isCorrect;
  84.     }
  85.     public function setIsCorrect(bool $correct): self
  86.     {
  87.         $this->isCorrect $correct;
  88.         return $this;
  89.     }
  90.     public function getQuestion(): Question
  91.     {
  92.         return $this->question;
  93.     }
  94.     public function setQuestion(Question $question): self
  95.     {
  96.         $this->question $question;
  97.         return $this;
  98.     }
  99.     public function getScore(): ?int
  100.     {
  101.         return $this->score;
  102.     }
  103.     public function setScore(?int $score): self
  104.     {
  105.         $this->score $score;
  106.         return $this;
  107.     }
  108. }