src/Entity/AnswerTranslation.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\AnswerTranslationRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. #[ORM\Entity(repositoryClassAnswerTranslationRepository::class)]
  8. #[ApiResource(
  9.     collectionOperations: [
  10.         'get'=>['normalization_context' => ['groups' => 'readQuestions']],
  11.         'post',
  12.     ],
  13.     itemOperations: [
  14.         'get'=>['normalization_context' => ['groups' => 'readQuestions']],
  15.         
  16.         'delete',
  17.         
  18.     ],
  19. )]
  20. class AnswerTranslation
  21. {
  22.     #[ORM\Id]
  23.     #[ORM\GeneratedValue]
  24.     #[ORM\Column]
  25.     #[Groups(["readQuestions","read"])]
  26.     private ?int $id null;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     #[Groups(["readQuestions","read"])]
  29.     private ?string $value null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     #[Groups(["readQuestions","read"])]
  32.     private ?string $locale null;
  33.     #[ORM\ManyToOne(inversedBy'translations')]
  34.     private ?Answer $answer null;
  35.     public function __toString()
  36.     {
  37.         return $this->value."(".$this->locale.")";
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getValue(): ?string
  44.     {
  45.         return $this->value;
  46.     }
  47.     public function setValue(?string $value): self
  48.     {
  49.         $this->value $value;
  50.         return $this;
  51.     }
  52.     public function getLocale(): ?string
  53.     {
  54.         return $this->locale;
  55.     }
  56.     public function setLocale(?string $locale): self
  57.     {
  58.         $this->locale $locale;
  59.         return $this;
  60.     }
  61.     public function getAnswer(): ?Answer
  62.     {
  63.         return $this->answer;
  64.     }
  65.     public function setAnswer(?Answer $answer): self
  66.     {
  67.         $this->answer $answer;
  68.         return $this;
  69.     }
  70. }