src/Entity/Form.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\FormRepository")
  8.  */
  9. class Form
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="bigint")
  15.      */
  16.     private $id;
  17.     
  18.     /**
  19.      * @ORM\Version @ORM\Column(type="integer")
  20.      */
  21.     private $version;
  22.     
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $title;
  27.     
  28.     /**
  29.      * @ORM\OneToMany(targetEntity="App\Entity\FormField", mappedBy="form", orphanRemoval=true, cascade={"persist", "remove"}, fetch="EAGER")
  30.      */
  31.     private $formFields;
  32.     public function __construct()
  33.     {
  34.         $this->title "";
  35.         $this->formFields = new ArrayCollection();
  36.     }
  37.     public function getId()
  38.     {
  39.         return $this->id;
  40.     }
  41.     
  42.     public function getVersion() {
  43.         return $this->version;
  44.     }
  45.     
  46.     public function getTitle(): ?string
  47.     {
  48.         return $this->title;
  49.     }
  50.     public function setTitle(string $title null): self
  51.     {
  52.         $this->title $title $title "";
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection|FormField[]
  57.      */
  58.     public function getFormFields(): Collection
  59.     {
  60.         return $this->formFields;
  61.     }
  62.     public function addFormField(FormField $formField): self
  63.     {
  64.         if (!$this->formFields->contains($formField)) {
  65.             $this->formFields[] = $formField;
  66.             $formField->setForm($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removeFormField(FormField $formField): self
  71.     {
  72.         if ($this->formFields->contains($formField)) {
  73.             $this->formFields->removeElement($formField);
  74.             // set the owning side to null (unless already changed)
  75.             if ($formField->getForm() === $this) {
  76.                 $formField->setForm(null);
  77.             }
  78.         }
  79.         
  80.         return $this;
  81.     }
  82.     
  83.     public function __toString ()
  84.     {
  85.         return $this->title $this->title '';
  86.     }
  87. }