src/Entity/QuestionTranslation.php line 24

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