src/Entity/SatisfactionSurveys/SatisfactionSurveyCustomerResponse.php line 40

Open in your IDE?
  1. <?php
  2. namespace App\Entity\SatisfactionSurveys;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Annotation\SatisfactionSurveyAware;
  5. use App\Annotation\SiteAware;
  6. use App\Entity\AbstractBase;
  7. use App\Entity\Garages\Garage;
  8. use App\Entity\Interfaces\SiteInterface;
  9. use App\Entity\Traits\ActiveTrait;
  10. use App\Entity\Traits\GarageTrait;
  11. use App\Entity\Traits\SiteTrait;
  12. use App\Repository\SatisfactionSurveys\SatisfactionSurveyCustomerResponseRepository;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Collection;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Gedmo\Mapping\Annotation as Gedmo;
  17. use Symfony\Component\Serializer\Annotation\Groups;
  18. /**
  19.  * @ApiResource(
  20.  *     shortName="satisfaction-survey-customer-response",
  21.  *     normalizationContext={"groups"={"api:read", "satisfaction_survey_customer_response:read"}, "swagger_definition_name"="Read"},
  22.  *     denormalizationContext={"groups"={"api:write", "satisfaction_survey_customer_response:write", "satisfaction_survey_customer_response:put"}, "swagger_definition_name"="Write"},
  23.  *     collectionOperations={"get", "post"},
  24.  *     itemOperations={"get", "put"}
  25.  * )
  26.  *
  27.  * @ORM\Table(name="vulco_satisfaction_survey_customer_response", indexes={@ORM\Index(name="satisfaction_survey_customer_response_site_idx", columns={"site"})})
  28.  *
  29.  * @ORM\Entity(repositoryClass=SatisfactionSurveyCustomerResponseRepository::class)
  30.  *
  31.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  32.  *
  33.  * @SatisfactionSurveyAware(satisfactionSurveyFieldName="survey_id")
  34.  *
  35.  * @SiteAware(siteFieldName="site")
  36.  */
  37. class SatisfactionSurveyCustomerResponse extends AbstractBase implements SiteInterface
  38. {
  39.     use ActiveTrait;
  40.     use GarageTrait;
  41.     use SiteTrait;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity="SatisfactionSurvey", inversedBy="questions")
  44.      *
  45.      * @Groups({"api:write", "satisfaction_survey_customer_response:write"})
  46.      */
  47.     private SatisfactionSurvey $survey;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity="App\Entity\Garages\Garage", fetch="EAGER")
  50.      *
  51.      * @Groups({"satisfaction_survey_customer_response:write"})
  52.      */
  53.     private ?Garage $garage null;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity="SatisfactionSurveyCustomerResponseAnswer", mappedBy="response", cascade={"persist", "remove"})
  56.      *
  57.      * @Groups({"satisfaction_survey_customer_response:write"})
  58.      */
  59.     private ?Collection $answers;
  60.     /**
  61.      * @ORM\Column(type="datetime", nullable=true)
  62.      *
  63.      * @Groups({"satisfaction_survey_customer_response:read", "satisfaction_survey_customer_response:write"})
  64.      */
  65.     private ?\DateTimeInterface $begin null;
  66.     /**
  67.      * @ORM\Column(type="datetime", nullable=true)
  68.      *
  69.      * @Groups({"satisfaction_survey_customer_response:read", "satisfaction_survey_customer_response:write"})
  70.      */
  71.     private ?\DateTimeInterface $end null;
  72.     /**
  73.      * @ORM\Column(type="text", length=10000, nullable=true)
  74.      *
  75.      * @Groups({"satisfaction_survey_customer_response:write"})
  76.      */
  77.     private ?string $comments null;
  78.     /**
  79.      * @ORM\Column(type="string", length=255, nullable=true)
  80.      *
  81.      * @Groups({"satisfaction_survey_customer_response:write"})
  82.      */
  83.     private ?string $howDidYouFindUsAnswer null;
  84.     /**
  85.      * @ORM\Column(type="string", length=255, nullable=true)
  86.      *
  87.      * @Groups({"satisfaction_survey_customer_response:put"})
  88.      */
  89.     private ?string $fullname null;
  90.     /**
  91.      * @ORM\Column(type="string", length=255, nullable=true)
  92.      *
  93.      * @Groups({"satisfaction_survey_customer_response:put"})
  94.      */
  95.     private ?string $email null;
  96.     /**
  97.      * @ORM\Column(type="boolean", nullable=false, options={"default": 0})
  98.      *
  99.      * @Groups({"satisfaction_survey_customer_response:put"})
  100.      */
  101.     private bool $wantsNewsletters false;
  102.     /**
  103.      * @ORM\Column(type="integer", nullable=false, options={"default": 0})
  104.      *
  105.      * @Groups({"satisfaction_survey_customer_response:put"})
  106.      */
  107.     private int $status 0;
  108.     /**
  109.      * @ORM\Column(type="boolean", nullable=false, options={"default": 1})
  110.      */
  111.     private bool $active true;
  112.     public function __construct()
  113.     {
  114.         $this->answers = new ArrayCollection();
  115.     }
  116.     public function getSurvey(): SatisfactionSurvey
  117.     {
  118.         return $this->survey;
  119.     }
  120.     public function setSurvey(SatisfactionSurvey $survey): self
  121.     {
  122.         $this->survey $survey;
  123.         return $this;
  124.     }
  125.     public function getAnswers(): ?Collection
  126.     {
  127.         return $this->answers;
  128.     }
  129.     public function setAnswers(?Collection $answers): self
  130.     {
  131.         $this->answers $answers;
  132.         return $this;
  133.     }
  134.     public function addAnswer(SatisfactionSurveyCustomerResponseAnswer $answer): self
  135.     {
  136.         if (!$this->answers->contains($answer)) {
  137.             $answer->setResponse($this);
  138.             $this->answers->add($answer);
  139.         }
  140.         return $this;
  141.     }
  142.     public function removeAnswer(SatisfactionSurveyCustomerResponseAnswer $answer): self
  143.     {
  144.         if ($this->answers->contains($answer)) {
  145.             $this->answers->removeElement($answer);
  146.         }
  147.         return $this;
  148.     }
  149.     public function getBegin(): ?\DateTimeInterface
  150.     {
  151.         return $this->begin;
  152.     }
  153.     public function getBeginString(): string
  154.     {
  155.         return $this->getDateTimeAsString($this->getBegin());
  156.     }
  157.     public function setBegin(?\DateTimeInterface $begin): self
  158.     {
  159.         $this->begin $begin;
  160.         return $this;
  161.     }
  162.     public function getEnd(): ?\DateTimeInterface
  163.     {
  164.         return $this->end;
  165.     }
  166.     public function getEndString(): string
  167.     {
  168.         return $this->getDateTimeAsString($this->getEnd());
  169.     }
  170.     public function setEnd(?\DateTimeInterface $end): self
  171.     {
  172.         $this->end $end;
  173.         return $this;
  174.     }
  175.     public function getComments(): ?string
  176.     {
  177.         return $this->comments;
  178.     }
  179.     public function setComments(?string $comments): self
  180.     {
  181.         $this->comments $comments;
  182.         return $this;
  183.     }
  184.     public function getHowDidYouFindUsAnswer(): ?string
  185.     {
  186.         return $this->howDidYouFindUsAnswer;
  187.     }
  188.     public function setHowDidYouFindUsAnswer(?string $howDidYouFindUsAnswer): self
  189.     {
  190.         $this->howDidYouFindUsAnswer $howDidYouFindUsAnswer;
  191.         return $this;
  192.     }
  193.     public function getFullname(): ?string
  194.     {
  195.         return $this->fullname;
  196.     }
  197.     public function setFullname(?string $fullname): self
  198.     {
  199.         $this->fullname $fullname;
  200.         return $this;
  201.     }
  202.     public function getEmail(): ?string
  203.     {
  204.         return $this->email;
  205.     }
  206.     public function setEmail(?string $email): self
  207.     {
  208.         $this->email $email;
  209.         return $this;
  210.     }
  211.     public function isWantsNewsletters(): bool
  212.     {
  213.         return $this->wantsNewsletters;
  214.     }
  215.     public function setWantsNewsletters(bool $wantsNewsletters): self
  216.     {
  217.         $this->wantsNewsletters $wantsNewsletters;
  218.         return $this;
  219.     }
  220.     public function getStatus(): int
  221.     {
  222.         return $this->status;
  223.     }
  224.     public function setStatus(int $status): self
  225.     {
  226.         $this->status $status;
  227.         return $this;
  228.     }
  229. }