<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity
* @ORM\Table(name="mmpp_form_field")
* @ORM\Entity(repositoryClass="App\Repository\FormulaireFieldRepository")
*/
class FormulaireField
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=40)
* @var string text, textarea, choice
*/
protected $type;
/**
* @ORM\Column(type="string", length=255)
*/
protected $label;
/**
* @Gedmo\Slug(fields={"label"}, updatable=false, separator="-", unique=false)
* @ORM\Column(type="string", length=255, unique=false)
* @var String
*/
protected $slug;
/**
* @ORM\Column(type="integer")
*/
protected $position;
/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $size;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $value;
/**
* @ORM\Column(type="boolean")
* @var unknown
*/
protected $required = false;
/**
* @ORM\ManyToOne(targetEntity="FormulaireBlock", inversedBy="fields")
* @ORM\JoinColumn(name="block_id", referencedColumnName="id")
*/
protected $block;
/**
* @ORM\OneToMany(targetEntity="FormulaireFieldChoiceValue", mappedBy="field", orphanRemoval=true, cascade={"all"} )
* @ORM\OrderBy({"position" = "ASC"})
* @var unknown
*/
protected $choiceValues;
/**
* @ORM\ManyToOne(targetEntity="FormulaireFieldChoiceValue", inversedBy="dependentFields" )
* @ORM\JoinColumn(name="depends_on_id", referencedColumnName="id")
* @var unknown
*/
protected $dependsOn;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set label
*
* @param string $label
* @return FormulaireField
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* Get label
*
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* Set position
*
* @param integer $position
* @return FormulaireField
*/
public function setPosition($position)
{
$this->position = $position;
return $this;
}
/**
* Get position
*
* @return integer
*/
public function getPosition()
{
return $this->position;
}
/**
* Set block
*
* @param \App\Entity\FormulaireBlock $block
* @return FormulaireField
*/
public function setBlock(\App\Entity\FormulaireBlock $block = null)
{
$this->block = $block;
return $this;
}
/**
* Get block
*
* @return \App\Entity\FormulaireBlock
*/
public function getBlock()
{
return $this->block;
}
/**
* Set type
*
* @param string $type
* @return FormulaireField
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Set required
*
* @param boolean $required
* @return FormulaireField
*/
public function setRequired($required)
{
$this->required = $required;
return $this;
}
/**
* Get required
*
* @return boolean
*/
public function getRequired()
{
return $this->required;
}
/**
* Set size
*
* @param integer $size
* @return FormulaireField
*/
public function setSize($size)
{
$this->size = $size;
return $this;
}
/**
* Get size
*
* @return integer
*/
public function getSize()
{
return $this->size;
}
/**
* Set value
*
* @param string $value
* @return FormulaireField
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return string
*/
public function getValue()
{
return $this->value;
}
/**
* Constructor
*/
public function __construct()
{
$this->choiceValues = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add choiceValues
*
* @param \App\Entity\FormulaireFieldChoiceValue $choiceValues
* @return FormulaireField
*/
public function addChoiceValue(\App\Entity\FormulaireFieldChoiceValue $choiceValues)
{
$choiceValues->setField($this);
$this->choiceValues[] = $choiceValues;
return $this;
}
/**
* Remove choiceValues
*
* @param \App\Entity\FormulaireFieldChoiceValue $choiceValues
*/
public function removeChoiceValue(\App\Entity\FormulaireFieldChoiceValue $choiceValues)
{
$this->choiceValues->removeElement($choiceValues);
}
/**
* Get choiceValues
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getChoiceValues()
{
return $this->choiceValues;
}
/**
* Set dependsOn
*
* @param \App\Entity\FormulaireFieldChoiceValue $dependsOn
* @return FormulaireField
*/
public function setDependsOn(\App\Entity\FormulaireFieldChoiceValue $dependsOn = null)
{
$this->dependsOn = $dependsOn;
return $this;
}
/**
* Get dependsOn
*
* @return \App\Entity\FormulaireFieldChoiceValue
*/
public function getDependsOn()
{
return $this->dependsOn;
}
/**
* Set slug
*
* @param string $slug
* @return FormulaireField
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
public function isRequired(): ?bool
{
return $this->required;
}
}