src/Flexy/FrontBundle/Entity/Form.php line 15

  1. <?php
  2. namespace App\Flexy\FrontBundle\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\Entity\FormRepository;
  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 Gedmo\Mapping\Annotation as Gedmo;
  10. #[ORM\Entity(repositoryClassFormRepository::class)]
  11. #[ApiResource]
  12. class Form
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  21.     private ?\DateTimeInterface $createdAt null;
  22.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  23.     private ?string $description null;
  24.     #[ORM\OneToMany(mappedBy'form'targetEntityFormField::class,cascade:["persist","remove"])]
  25.     private Collection $formFields;
  26.     #[ORM\OneToMany(mappedBy'form'targetEntityFormField::class,cascade:["persist","remove"])]
  27.     private Collection $formDatas;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     #[Gedmo\Slug(fields: ['name'], unique:trueupdatable:false)]
  30.     private ?string $slug null;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $submitBtnLabel null;
  33.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  34.     private ?string $customCss null;
  35.     public function __construct()
  36.     {
  37.         $this->formFields = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): static
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     public function getCreatedAt(): ?\DateTimeInterface
  53.     {
  54.         return $this->createdAt;
  55.     }
  56.     public function setCreatedAt(?\DateTimeInterface $createdAt): static
  57.     {
  58.         $this->createdAt $createdAt;
  59.         return $this;
  60.     }
  61.     public function getDescription(): ?string
  62.     {
  63.         return $this->description;
  64.     }
  65.     public function setDescription(?string $description): static
  66.     {
  67.         $this->description $description;
  68.         return $this;
  69.     }
  70.     /**
  71.      * @return Collection<int, FormField>
  72.      */
  73.     public function getFormFields(): Collection
  74.     {
  75.         return $this->formFields;
  76.     }
  77.     public function addFormField(FormField $formField): static
  78.     {
  79.         if (!$this->formFields->contains($formField)) {
  80.             $this->formFields->add($formField);
  81.             $formField->setForm($this);
  82.         }
  83.         return $this;
  84.     }
  85.     public function removeFormField(FormField $formField): static
  86.     {
  87.         if ($this->formFields->removeElement($formField)) {
  88.             // set the owning side to null (unless already changed)
  89.             if ($formField->getForm() === $this) {
  90.                 $formField->setForm(null);
  91.             }
  92.         }
  93.         return $this;
  94.     }
  95.     public function getSlug(): ?string
  96.     {
  97.         return $this->slug;
  98.     }
  99.     public function setSlug(?string $slug): static
  100.     {
  101.         $this->slug $slug;
  102.         return $this;
  103.     }
  104.         /**
  105.      * @return Collection<int, FormData>
  106.      */
  107.     public function getFormDatas(): Collection
  108.     {
  109.         return $this->formDatas;
  110.     }
  111.     public function addFormData(FormData $formData): static
  112.     {
  113.         if (!$this->formDatas->contains($formData)) {
  114.             $this->formDatas->add($formData);
  115.             $formData->setForm($this);
  116.         }
  117.         return $this;
  118.     }
  119.     public function removeFormData(FormData $formData): static
  120.     {
  121.         if ($this->formDatas->removeElement($formData)) {
  122.             // set the owning side to null (unless already changed)
  123.             if ($formData->getForm() === $this) {
  124.                 $formData->setForm(null);
  125.             }
  126.         }
  127.         return $this;
  128.     }
  129.     public function getSubmitBtnLabel(): ?string
  130.     {
  131.         return $this->submitBtnLabel;
  132.     }
  133.     public function setSubmitBtnLabel(?string $submitBtnLabel): static
  134.     {
  135.         $this->submitBtnLabel $submitBtnLabel;
  136.         return $this;
  137.     }
  138.     public function getCustomCss(): ?string
  139.     {
  140.         return $this->customCss;
  141.     }
  142.     public function setCustomCss(?string $customCss): static
  143.     {
  144.         $this->customCss $customCss;
  145.         return $this;
  146.     }
  147. }