src/Entity/Channel/PositioningTest/QuestionAnswer.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Channel\PositioningTest;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use DrosalysWeb\ObjectExtensions\Blame\Model\BlameInterface;
  7. use DrosalysWeb\ObjectExtensions\Blame\Model\BlameTrait;
  8. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampInterface;
  9. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampTrait;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. #[
  12. ORM\Entity(),
  13. ORM\Table(name: 'channel_positioning_test_question_answers'),
  14. ]
  15. class QuestionAnswer implements TimestampInterface, BlameInterface
  16. {
  17. use TimestampTrait;
  18. use BlameTrait;
  19. #[ORM\Id]
  20. #[ORM\GeneratedValue]
  21. #[ORM\Column(type: 'integer')]
  22. private ?int $id = null;
  23. #[ORM\Column(type: 'boolean')]
  24. private bool $valid = false;
  25. #[ORM\Column(type: 'string', length: 255)]
  26. #[
  27. Assert\NotBlank(message: 'positioningTest.question.label.NotBlank'),
  28. Assert\Length(
  29. max: 255,
  30. maxMessage: 'positioningTest.question.label.Length.max'
  31. )
  32. ]
  33. private ?string $label = null;
  34. #[ORM\Column(type: 'integer')]
  35. private ?int $rank = null;
  36. #[ORM\ManyToOne(targetEntity: Question::class, inversedBy: 'answers')]
  37. #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
  38. private ?Question $question = null;
  39. public function getId(): ?int
  40. {
  41. return $this->id;
  42. }
  43. public function isValid(): bool
  44. {
  45. return $this->valid;
  46. }
  47. public function setValid(bool $valid): static
  48. {
  49. $this->valid = $valid;
  50. return $this;
  51. }
  52. public function getLabel(): ?string
  53. {
  54. return $this->label;
  55. }
  56. public function setLabel(?string $label): static
  57. {
  58. $this->label = $label;
  59. return $this;
  60. }
  61. public function getRank(): ?int
  62. {
  63. return $this->rank;
  64. }
  65. public function setRank(?int $rank): static
  66. {
  67. $this->rank = $rank;
  68. return $this;
  69. }
  70. public function getQuestion(): ?Question
  71. {
  72. return $this->question;
  73. }
  74. public function setQuestion(?Question $question): static
  75. {
  76. $this->question = $question;
  77. return $this;
  78. }
  79. }