src/Flexy/FrontBundle/Entity/Form.php line 15
<?php
namespace App\Flexy\FrontBundle\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\Entity\FormRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Entity(repositoryClass: FormRepository::class)]
#[ApiResource]
class Form
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\OneToMany(mappedBy: 'form', targetEntity: FormField::class,cascade:["persist","remove"])]
private Collection $formFields;
#[ORM\OneToMany(mappedBy: 'form', targetEntity: FormField::class,cascade:["persist","remove"])]
private Collection $formDatas;
#[ORM\Column(length: 255, nullable: true)]
#[Gedmo\Slug(fields: ['name'], unique:true, updatable:false)]
private ?string $slug = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $submitBtnLabel = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $customCss = null;
public function __construct()
{
$this->formFields = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, FormField>
*/
public function getFormFields(): Collection
{
return $this->formFields;
}
public function addFormField(FormField $formField): static
{
if (!$this->formFields->contains($formField)) {
$this->formFields->add($formField);
$formField->setForm($this);
}
return $this;
}
public function removeFormField(FormField $formField): static
{
if ($this->formFields->removeElement($formField)) {
// set the owning side to null (unless already changed)
if ($formField->getForm() === $this) {
$formField->setForm(null);
}
}
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): static
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, FormData>
*/
public function getFormDatas(): Collection
{
return $this->formDatas;
}
public function addFormData(FormData $formData): static
{
if (!$this->formDatas->contains($formData)) {
$this->formDatas->add($formData);
$formData->setForm($this);
}
return $this;
}
public function removeFormData(FormData $formData): static
{
if ($this->formDatas->removeElement($formData)) {
// set the owning side to null (unless already changed)
if ($formData->getForm() === $this) {
$formData->setForm(null);
}
}
return $this;
}
public function getSubmitBtnLabel(): ?string
{
return $this->submitBtnLabel;
}
public function setSubmitBtnLabel(?string $submitBtnLabel): static
{
$this->submitBtnLabel = $submitBtnLabel;
return $this;
}
public function getCustomCss(): ?string
{
return $this->customCss;
}
public function setCustomCss(?string $customCss): static
{
$this->customCss = $customCss;
return $this;
}
}