<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\FaqAnswerRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* The field is the uri of the associated question
* The value is the answer content
* @ORM\Entity(repositoryClass=FaqAnswerRepository::class)
* @ApiResource(
* denormalizationContext={
* "groups"={"faq_answer:write"}
* },
* normalizationContext={
* "groups"={"faq_answer:read"}
* },
* collectionOperations={
* "post"={"security"="is_granted('ROLE_ADMIN')"},
* "get"={"security"="is_granted('ROLE_USER')"},
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_USER')"},
* "delete"={"security"="is_granted('ROLE_ADMIN')"},
* "patch"={"security"="is_granted('ROLE_ADMIN')"},
* },
* )
*/
class FaqAnswer extends TvConfiguration
{
/**
* @var string
* @Groups({"faq_answer:write","faq_answer:read"})
*/
private $question;
/**
* @return int|string
*/
public function getQuestion()
{
if ($this->question == null){
$this->question = $this->field;
}
return $this->question;
}
/**
* @param int|string $question
* @return FaqAnswer
*/
public function setQuestion(string $question) :FaqAnswer
{
$this->question = $question;
$this->field = $question;
return $this;
}
public function getField(): ?string
{
return $this->field;
}
public function setField(string $field): TvConfiguration
{
$this->field = $field;
$this->question = $field;
return $this;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(string $value): TvConfiguration
{
$this->value = $value;
$this->advice = $value;
return $this;
}
}