src/Entity/FormulaireField.php line 15

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 Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8.  * @ORM\Entity
  9.  * @ORM\Table(name="mmpp_form_field")
  10.  * @ORM\Entity(repositoryClass="App\Repository\FormulaireFieldRepository")
  11.  */
  12. class FormulaireField
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\Column(type="integer")
  17.      * @ORM\GeneratedValue(strategy="AUTO")
  18.      */
  19.     protected $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=40)
  22.      * @var string text, textarea, choice
  23.      */
  24.     protected $type;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      */
  28.     protected $label;
  29.     /**
  30.      * @Gedmo\Slug(fields={"label"}, updatable=false, separator="-", unique=false)
  31.      * @ORM\Column(type="string", length=255, unique=false)
  32.      * @var String
  33.      */
  34.     protected $slug;
  35.     /**
  36.      * @ORM\Column(type="integer")
  37.      */
  38.     protected $position;
  39.     /**
  40.      * @ORM\Column(type="integer", nullable=true)
  41.      */
  42.     protected $size;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     protected $value;
  47.     /**
  48.      * @ORM\Column(type="boolean")
  49.      * @var unknown
  50.      */
  51.     protected $required false;
  52.     /**
  53.      * @ORM\ManyToOne(targetEntity="FormulaireBlock", inversedBy="fields")
  54.      * @ORM\JoinColumn(name="block_id", referencedColumnName="id")
  55.      */
  56.     protected $block;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity="FormulaireFieldChoiceValue", mappedBy="field", orphanRemoval=true, cascade={"all"} )
  59.      * @ORM\OrderBy({"position" = "ASC"})
  60.      * @var unknown
  61.      */
  62.     protected $choiceValues;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity="FormulaireFieldChoiceValue", inversedBy="dependentFields" )
  65.      * @ORM\JoinColumn(name="depends_on_id", referencedColumnName="id")
  66.      * @var unknown
  67.      */
  68.     protected $dependsOn;
  69.     /**
  70.      * Get id
  71.      *
  72.      * @return integer
  73.      */
  74.     public function getId()
  75.     {
  76.         return $this->id;
  77.     }
  78.     /**
  79.      * Set label
  80.      *
  81.      * @param string $label
  82.      * @return FormulaireField
  83.      */
  84.     public function setLabel($label)
  85.     {
  86.         $this->label $label;
  87.         return $this;
  88.     }
  89.     /**
  90.      * Get label
  91.      *
  92.      * @return string
  93.      */
  94.     public function getLabel()
  95.     {
  96.         return $this->label;
  97.     }
  98.     /**
  99.      * Set position
  100.      *
  101.      * @param integer $position
  102.      * @return FormulaireField
  103.      */
  104.     public function setPosition($position)
  105.     {
  106.         $this->position $position;
  107.         return $this;
  108.     }
  109.     /**
  110.      * Get position
  111.      *
  112.      * @return integer
  113.      */
  114.     public function getPosition()
  115.     {
  116.         return $this->position;
  117.     }
  118.     /**
  119.      * Set block
  120.      *
  121.      * @param \App\Entity\FormulaireBlock $block
  122.      * @return FormulaireField
  123.      */
  124.     public function setBlock(\App\Entity\FormulaireBlock $block null)
  125.     {
  126.         $this->block $block;
  127.         return $this;
  128.     }
  129.     /**
  130.      * Get block
  131.      *
  132.      * @return \App\Entity\FormulaireBlock
  133.      */
  134.     public function getBlock()
  135.     {
  136.         return $this->block;
  137.     }
  138.     /**
  139.      * Set type
  140.      *
  141.      * @param string $type
  142.      * @return FormulaireField
  143.      */
  144.     public function setType($type)
  145.     {
  146.         $this->type $type;
  147.         return $this;
  148.     }
  149.     /**
  150.      * Get type
  151.      *
  152.      * @return string
  153.      */
  154.     public function getType()
  155.     {
  156.         return $this->type;
  157.     }
  158.     /**
  159.      * Set required
  160.      *
  161.      * @param boolean $required
  162.      * @return FormulaireField
  163.      */
  164.     public function setRequired($required)
  165.     {
  166.         $this->required $required;
  167.         return $this;
  168.     }
  169.     /**
  170.      * Get required
  171.      *
  172.      * @return boolean
  173.      */
  174.     public function getRequired()
  175.     {
  176.         return $this->required;
  177.     }
  178.     /**
  179.      * Set size
  180.      *
  181.      * @param integer $size
  182.      * @return FormulaireField
  183.      */
  184.     public function setSize($size)
  185.     {
  186.         $this->size $size;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get size
  191.      *
  192.      * @return integer
  193.      */
  194.     public function getSize()
  195.     {
  196.         return $this->size;
  197.     }
  198.     /**
  199.      * Set value
  200.      *
  201.      * @param string $value
  202.      * @return FormulaireField
  203.      */
  204.     public function setValue($value)
  205.     {
  206.         $this->value $value;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get value
  211.      *
  212.      * @return string
  213.      */
  214.     public function getValue()
  215.     {
  216.         return $this->value;
  217.     }
  218.     /**
  219.      * Constructor
  220.      */
  221.     public function __construct()
  222.     {
  223.         $this->choiceValues = new \Doctrine\Common\Collections\ArrayCollection();
  224.     }
  225.     /**
  226.      * Add choiceValues
  227.      *
  228.      * @param \App\Entity\FormulaireFieldChoiceValue $choiceValues
  229.      * @return FormulaireField
  230.      */
  231.     public function addChoiceValue(\App\Entity\FormulaireFieldChoiceValue $choiceValues)
  232.     {
  233.         $choiceValues->setField($this);
  234.         $this->choiceValues[] = $choiceValues;
  235.         return $this;
  236.     }
  237.     /**
  238.      * Remove choiceValues
  239.      *
  240.      * @param \App\Entity\FormulaireFieldChoiceValue $choiceValues
  241.      */
  242.     public function removeChoiceValue(\App\Entity\FormulaireFieldChoiceValue $choiceValues)
  243.     {
  244.         $this->choiceValues->removeElement($choiceValues);
  245.     }
  246.     /**
  247.      * Get choiceValues
  248.      *
  249.      * @return \Doctrine\Common\Collections\Collection
  250.      */
  251.     public function getChoiceValues()
  252.     {
  253.         return $this->choiceValues;
  254.     }
  255.     /**
  256.      * Set dependsOn
  257.      *
  258.      * @param \App\Entity\FormulaireFieldChoiceValue $dependsOn
  259.      * @return FormulaireField
  260.      */
  261.     public function setDependsOn(\App\Entity\FormulaireFieldChoiceValue $dependsOn null)
  262.     {
  263.         $this->dependsOn $dependsOn;
  264.         return $this;
  265.     }
  266.     /**
  267.      * Get dependsOn
  268.      *
  269.      * @return \App\Entity\FormulaireFieldChoiceValue
  270.      */
  271.     public function getDependsOn()
  272.     {
  273.         return $this->dependsOn;
  274.     }
  275.     /**
  276.      * Set slug
  277.      *
  278.      * @param string $slug
  279.      * @return FormulaireField
  280.      */
  281.     public function setSlug($slug)
  282.     {
  283.         $this->slug $slug;
  284.         return $this;
  285.     }
  286.     /**
  287.      * Get slug
  288.      *
  289.      * @return string
  290.      */
  291.     public function getSlug()
  292.     {
  293.         return $this->slug;
  294.     }
  295.     public function isRequired(): ?bool
  296.     {
  297.         return $this->required;
  298.     }
  299. }