sf4 deprecated: migrate Doctrine ORM mapping to annotation

This commit is contained in:
2020-07-24 17:45:32 +02:00
parent a38208f5cf
commit 3a03d44e9a
8 changed files with 187 additions and 174 deletions

View File

@@ -19,93 +19,134 @@
namespace Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
*
* @ORM\Entity(
* repositoryClass="Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository")
* @ORM\Table(name="custom_field_long_choice_options")
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class Option
{
/**
* @var integer
*
* @var int
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
*
* @var string
* @ORM\Column(type="string", length=15)
*/
private $key;
/**
* a json representation of text (multilingual)
* A json representation of text (multilingual)
*
* @var array
* @ORM\Column(type="text")
*/
private $text;
/**
*
* @var \Doctrine\Common\Collections\Collection
* @var Collection
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option",
* mappedBy="parent")
*/
private $children;
/**
*
* @var Option
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option",
* inversedBy="children")
* @ORM\JoinColumn(nullable=true)
*/
private $parent;
/**
*
* @var string
* @ORM\Column(type="string", length=50, name="internal_key")
*/
private $internalKey = '';
/**
*
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getKey()
{
return $this->key;
}
/**
* @return array
*/
public function getText()
{
return $this->text;
}
/**
* @return Collection
*/
public function getChildren()
{
return $this->children;
}
/**
* @return Option
*/
public function getParent()
{
return $this->parent;
}
/**
* @param $key
* @return $this
*/
public function setKey($key)
{
$this->key = $key;
return $this;
}
/**
* @param array $text
* @return $this
*/
public function setText(array $text)
{
$this->text = $text;
return $this;
}
/**
* @param Option|null $parent
* @return $this
*/
public function setParent(Option $parent = null)
{
$this->parent = $parent;
@@ -122,32 +163,48 @@ class Option
return $this->parent === NULL ? false : true;
}
/**
* @return string
*/
public function getInternalKey()
{
return $this->internalKey;
}
/**
* @return bool
*/
public function isActive()
{
return $this->active;
}
/**
* @return bool
*/
public function getActive()
{
return $this->isActive();
}
/**
* @param $internal_key
* @return $this
*/
public function setInternalKey($internal_key)
{
$this->internalKey = $internal_key;
return $this;
}
/**
* @param $active
* @return $this
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
}