<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\AnswerTranslationRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: AnswerTranslationRepository::class)]
#[ApiResource(
collectionOperations: [
'get'=>['normalization_context' => ['groups' => 'readQuestions']],
'post',
],
itemOperations: [
'get'=>['normalization_context' => ['groups' => 'readQuestions']],
'delete',
],
)]
class AnswerTranslation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(["readQuestions","read"])]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["readQuestions","read"])]
private ?string $value = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["readQuestions","read"])]
private ?string $locale = null;
#[ORM\ManyToOne(inversedBy: 'translations')]
private ?Answer $answer = null;
public function __toString()
{
return $this->value."(".$this->locale.")";
}
public function getId(): ?int
{
return $this->id;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(?string $value): self
{
$this->value = $value;
return $this;
}
public function getLocale(): ?string
{
return $this->locale;
}
public function setLocale(?string $locale): self
{
$this->locale = $locale;
return $this;
}
public function getAnswer(): ?Answer
{
return $this->answer;
}
public function setAnswer(?Answer $answer): self
{
$this->answer = $answer;
return $this;
}
}