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

@@ -21,60 +21,88 @@
namespace Chill\CustomFieldsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* CustomField
*
* @ORM\Entity()
* @ORM\Table(null)
* @ORM\HasLifecycleCallbacks()
*/
class CustomField
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $type;
/**
* @var boolean
*
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
*
* @var array
*
* @ORM\Column(type="json_array")
*/
private $options = array();
/**
* @var array
*
* @ORM\Column(type="json_array")
*/
private $name;
/**
* @var float
*
* @ORM\Column(type="float")
*/
private $ordering;
/**
* @var boolean
*
* @var bolean
* @ORM\Column(type="boolean")
*/
private $required = FALSE;
const ONE_TO_ONE = 1;
const ONE_TO_MANY = 2;
/**
* @var CustomFieldsGroup
*
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup",
* inversedBy="customFields")
*/
private $customFieldGroup;
/**
* Get id
*
@@ -85,22 +113,26 @@ class CustomField
return $this->id;
}
/**
* @return string
*/
function getSlug()
{
return $this->slug;
}
/**
* @return array
*/
function getOptions()
{
return $this->options;
}
/**
* Set type
*
* @param string $type
*
* @return CustomField
*/
public function setType($type)
@@ -125,7 +157,6 @@ class CustomField
* Set active
*
* @param boolean $active
*
* @return CustomField
*/
public function setActive($active)
@@ -158,11 +189,10 @@ class CustomField
/**
* Set customFieldGroup
*
* @param \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup
*
* @param CustomFieldsGroup $customFieldGroup
* @return CustomField
*/
public function setCustomFieldsGroup(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null)
public function setCustomFieldsGroup(CustomFieldsGroup $customFieldGroup = null)
{
$this->customFieldGroup = $customFieldGroup;
@@ -173,7 +203,6 @@ class CustomField
* Set name
*
* @param array $name
*
* @return CustomField
*/
public function setName($name)
@@ -212,7 +241,6 @@ class CustomField
* Set order
*
* @param float $order
*
* @return CustomField
*/
public function setOrdering($order)
@@ -236,7 +264,6 @@ class CustomField
* Set options
*
* @param array $options
*
* @return CustomField
*/
public function setOptions(array $options)
@@ -245,8 +272,11 @@ class CustomField
return $this;
}
/**
* @param $slug
* @return $this
*/
public function setSlug($slug)
{
$this->slug = $slug;
@@ -278,8 +308,5 @@ class CustomField
$this->required = $required;
return $this;
}
}