src/Entity/CompanyFormGroup.php line 13

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. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\CompanyFormGroupRepository")
  9.  */
  10. class CompanyFormGroup
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @var string
  20.      *
  21.      * @ORM\Column(type="string", length=128, nullable=true)
  22.      * @Assert\Length(max="128")
  23.      * @Assert\NotBlank()
  24.      */
  25.     private $title;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(type="string", length=128)
  30.      * @Assert\Length(max="128")
  31.      * @Assert\NotBlank()
  32.      */
  33.     private $label;
  34.     /**
  35.      * @var int
  36.      *
  37.      * @ORM\Column(type="integer")
  38.      * @Assert\NotBlank()
  39.      * @Assert\Type(type="integer")
  40.      */
  41.     private $position;
  42.     /**
  43.      * @var CompanyFormPage
  44.      *
  45.      * @ORM\ManyToOne(targetEntity="App\Entity\CompanyFormPage", inversedBy="formGroups")
  46.      * @ORM\JoinColumn(onDelete="CASCADE")
  47.      * @Assert\NotNull()
  48.      */
  49.     private $formPage;
  50.     /**
  51.      * @var ArrayCollection
  52.      *
  53.      * @ORM\OneToMany(targetEntity="App\Entity\CompanyFormQuestion", mappedBy="formGroup", cascade={"persist"})
  54.      */
  55.     private $formQuestions;
  56.     /**
  57.      * CompanyFormGroup constructor.
  58.      *
  59.      * @throws \Exception
  60.      */
  61.     public function __construct()
  62.     {
  63.         $this->formQuestions = new ArrayCollection();
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getPosition(): ?int
  70.     {
  71.         return $this->position;
  72.     }
  73.     public function setPosition(int $position): self
  74.     {
  75.         $this->position $position;
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return Collection|CompanyFormQuestion[]
  80.      */
  81.     public function getFormQuestions(): Collection
  82.     {
  83.         return $this->formQuestions;
  84.     }
  85.     public function addFormQuestion(CompanyFormQuestion $formQuestion): self
  86.     {
  87.         if (!$this->formQuestions->contains($formQuestion)) {
  88.             $this->formQuestions[] = $formQuestion;
  89.             $formQuestion->setFormGroup($this);
  90.         }
  91.         return $this;
  92.     }
  93.     public function removeFormQuestion(CompanyFormQuestion $formQuestion): self
  94.     {
  95.         if ($this->formQuestions->contains($formQuestion)) {
  96.             $this->formQuestions->removeElement($formQuestion);
  97.             // set the owning side to null (unless already changed)
  98.             if ($formQuestion->getFormGroup() === $this) {
  99.                 $formQuestion->setFormGroup(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104.     public function getFormPage(): ?CompanyFormPage
  105.     {
  106.         return $this->formPage;
  107.     }
  108.     public function setFormPage(?CompanyFormPage $formPage): self
  109.     {
  110.         $this->formPage $formPage;
  111.         return $this;
  112.     }
  113.     public function getTitle(): ?string
  114.     {
  115.         return $this->title;
  116.     }
  117.     public function setTitle(?string $title): self
  118.     {
  119.         $this->title $title;
  120.         return $this;
  121.     }
  122.     public function getLabel(): ?string
  123.     {
  124.         return $this->label;
  125.     }
  126.     public function setLabel(string $label): self
  127.     {
  128.         $this->label $label;
  129.         return $this;
  130.     }
  131. }