<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\QuestionTranslationRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: QuestionTranslationRepository::class)]
#[ApiResource(
collectionOperations: [
'get'=>['normalization_context' => ['groups' => ['readQuestions','read']]],
'post',
],
itemOperations: [
'get'=>['normalization_context' => ['groups' => ['readQuestions','read']]],
'put',
'delete',
],
)]
class QuestionTranslation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(["readQuestions","read"])]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["readQuestions","read"])]
private ?string $content = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["readQuestions","read"])]
private ?string $locale = null;
#[ORM\ManyToOne(inversedBy: 'translations')]
private ?Question $question = null;
public function __toString()
{
return $this->content."(".$this->locale.")";
}
public function getId(): ?int
{
return $this->id;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getLocale(): ?string
{
return $this->locale;
}
public function setLocale(?string $locale): self
{
$this->locale = $locale;
return $this;
}
public function getQuestion(): ?Question
{
return $this->question;
}
public function setQuestion(?Question $question): self
{
$this->question = $question;
return $this;
}
}