src/Entity/FormFields.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\FormFieldsRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use ApiPlatform\Metadata\ApiFilter;
  11. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  12. #[ORM\Entity(repositoryClassFormFieldsRepository::class)]
  13. #[ApiResource]
  14. #[ApiFilter(SearchFilter::class, properties: [
  15.     'form.id' => 'exact'
  16. ])]
  17. class FormFields
  18. {
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     #[Groups(['form:read''form:write''formAnswer:read''formAnswer:write'])]
  23.     private ?int $id null;
  24.     #[ORM\Column(length255)]
  25.     #[Groups(['form:read''form:write''formAnswer:read''formAnswer:write'])]
  26.     private ?string $label null;
  27.     #[ORM\Column(length255)]
  28.     #[Groups(['form:read''form:write''formAnswer:read''formAnswer:write'])]
  29.     private ?string $type null;
  30.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  31.     #[Groups(['form:read''form:write''formAnswer:read''formAnswer:write'])]
  32.     private ?string $defaultValue null;
  33.     #[ORM\ManyToOne(inversedBy'formFields')]
  34.     #[Groups(['form:read''form:write''formAnswer:read''formAnswer:write'])]
  35.     private ?Form $form null;
  36.     #[Groups(['form:read''form:write''formAnswer:read''formAnswer:write'])]
  37.     #[ORM\Column(length255nullabletrue)]
  38.     private ?string $name null;
  39.     #[ORM\OneToMany(mappedBy'formField'targetEntityFormAnswerFields::class)]
  40.     private Collection $formAnswerFields;
  41.     #[Groups(['form:read''form:write''formAnswer:read''formAnswer:write'])]
  42.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  43.     private ?string $selectedLabelInput null;
  44.     public function __construct()
  45.     {
  46.         $this->formAnswerFields = new ArrayCollection();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getLabel(): ?string
  53.     {
  54.         return $this->label;
  55.     }
  56.     public function setLabel(string $label): self
  57.     {
  58.         $this->label $label;
  59.         return $this;
  60.     }
  61.     public function getType(): ?string
  62.     {
  63.         return $this->type;
  64.     }
  65.     public function setType(string $type): self
  66.     {
  67.         $this->type $type;
  68.         return $this;
  69.     }
  70.     public function getDefaultValue(): ?string
  71.     {
  72.         return $this->defaultValue;
  73.     }
  74.     public function setDefaultValue(?string $defaultValue): self
  75.     {
  76.         $this->defaultValue $defaultValue;
  77.         return $this;
  78.     }
  79.     public function getForm(): ?Form
  80.     {
  81.         return $this->form;
  82.     }
  83.     public function setForm(?Form $form): self
  84.     {
  85.         $this->form $form;
  86.         return $this;
  87.     }
  88.     public function getName(): ?string
  89.     {
  90.         return $this->name;
  91.     }
  92.     public function setName(?string $name): self
  93.     {
  94.         $this->name $name;
  95.         return $this;
  96.     }
  97.     /**
  98.      * @return Collection<int, FormAnswerFields>
  99.      */
  100.     public function getFormAnswerFields(): Collection
  101.     {
  102.         return $this->formAnswerFields;
  103.     }
  104.     public function addFormAnswerField(FormAnswerFields $formAnswerField): self
  105.     {
  106.         if (!$this->formAnswerFields->contains($formAnswerField)) {
  107.             $this->formAnswerFields->add($formAnswerField);
  108.             $formAnswerField->setFormField($this);
  109.         }
  110.         return $this;
  111.     }
  112.     public function removeFormAnswerField(FormAnswerFields $formAnswerField): self
  113.     {
  114.         if ($this->formAnswerFields->removeElement($formAnswerField)) {
  115.             // set the owning side to null (unless already changed)
  116.             if ($formAnswerField->getFormField() === $this) {
  117.                 $formAnswerField->setFormField(null);
  118.             }
  119.         }
  120.         return $this;
  121.     }
  122.     public function getSelectedLabelInput(): ?string
  123.     {
  124.         return $this->selectedLabelInput;
  125.     }
  126.     public function setSelectedLabelInput(?string $selectedLabelInput): self
  127.     {
  128.         $this->selectedLabelInput $selectedLabelInput;
  129.         return $this;
  130.     }
  131. }