<?php
namespace App\Entity\SatisfactionSurveys;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Annotation\SiteAware;
use App\Entity\AbstractBase;
use App\Entity\Interfaces\SiteInterface;
use App\Entity\Traits\SiteTrait;
use App\Repository\SatisfactionSurveys\SatisfactionSurveyCustomerResponseAnswerRepository;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* shortName="satisfaction-survey-customer-response-answer",
* normalizationContext={"groups"={"api:read", "satisfaction_survey_customer_response_anwser:read"}},
* denormalizationContext={"groups"={"satisfaction_survey_customer_response_anwser:write"}},
* collectionOperations={"get"},
* itemOperations={"get", "put"}
* ).
*
* @ORM\Table(name="vulco_satisfaction_survey_customer_response_answer", indexes={@ORM\Index(name="satisfaction_survey_customer_response_answer_site_idx", columns={"site"})})
* @ORM\Entity(repositoryClass=SatisfactionSurveyCustomerResponseAnswerRepository::class)
* @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
* @SiteAware(siteFieldName="site")
*/
class SatisfactionSurveyCustomerResponseAnswer extends AbstractBase implements SiteInterface
{
use SiteTrait;
/**
* @ORM\ManyToOne(targetEntity="SatisfactionSurveyQuestion", inversedBy="answers")
* @Groups({"api:write", "satisfaction_survey_customer_response:write"})
*/
private SatisfactionSurveyQuestion $question;
/**
* @ORM\ManyToOne(targetEntity="SatisfactionSurveyCustomerResponse", inversedBy="answers")
* @Groups({"api:write", "satisfaction_survey_customer_response:write"})
*/
private SatisfactionSurveyCustomerResponse $response;
/**
* @ORM\Column(type="datetime", nullable=false)
* @Groups({"api:write", "satisfaction_survey_customer_response:write"})
*/
private DateTimeInterface $moment;
/**
* @ORM\Column(type="integer", nullable=false, options={"default": 0})
* @Groups({"api:write", "satisfaction_survey_customer_response:write"})
*/
private int $value = 0;
public function getQuestion(): SatisfactionSurveyQuestion
{
return $this->question;
}
public function setQuestion(SatisfactionSurveyQuestion $question): self
{
$this->question = $question;
return $this;
}
public function getResponse(): SatisfactionSurveyCustomerResponse
{
return $this->response;
}
public function setResponse(SatisfactionSurveyCustomerResponse $response): self
{
$this->response = $response;
return $this;
}
public function getMoment(): DateTimeInterface
{
return $this->moment;
}
public function getMomentString(): string
{
return $this->getDateTimeAsString($this->getMoment());
}
public function setMoment(DateTimeInterface $moment): self
{
$this->moment = $moment;
return $this;
}
public function getValue(): int
{
return $this->value;
}
public function setValue(int $value): self
{
$this->value = $value;
return $this;
}
}