implementation of customFieldBundle

This commit is contained in:
2014-10-29 16:43:13 +01:00
parent 2254acd8ee
commit 26a0b1e056
27 changed files with 902 additions and 97 deletions

View File

@@ -57,4 +57,3 @@ class Adress
return $this->data;
}
}

View File

@@ -159,4 +159,3 @@ class BlopEntity
var_dump($customFieldArray);
}
}

View File

@@ -245,4 +245,3 @@ class BlopEntity2
return $this->customFieldData;
}
}

View File

@@ -29,8 +29,22 @@ class CustomField
*/
private $active;
/**
*
* @var array
*/
private $options = array();
/**
* @var array
*/
private $name;
/**
* @var float
*/
private $order;
/**
*
* @var int
@@ -40,6 +54,10 @@ class CustomField
const ONE_TO_ONE = 1;
const ONE_TO_MANY = 2;
/**
* @var CustomFieldsGroup
*/
private $customFieldGroup;
/**
* Get id
@@ -149,5 +167,114 @@ class CustomField
{
return $this->active;
}
}
/**
* Get customFieldGroup
*
* @return CustomFieldsGroup
*/
public function getCustomFieldsGroup()
{
return $this->customFieldGroup;
}
/**
* Set customFieldGroup
*
* @param \CL\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup
*
* @return CustomField
*/
public function setCustomFieldsGroup(\CL\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null)
{
$this->customFieldGroup = $customFieldGroup;
return $this;
}
/**
* Set name
*
* @param array $name
*
* @return CustomField
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return array
*/
public function getName()
{
return $this->name;
}
/**
* Set order
*
* @param float $order
*
* @return CustomField
*/
public function setOrder($order)
{
$this->order = $order;
return $this;
}
/**
* Get order
*
* @return float
*/
public function getOrder()
{
return $this->order;
}
/**
* Set options
*
* @param array $options
*
* @return CustomField
*/
public function setOptions(array $options)
{
$this->options = $options;
return $this;
}
/**
* Set customFieldGroup
*
* @param \CL\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup
*
* @return CustomField
*/
public function setCustomFieldGroup(\CL\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null)
{
$this->customFieldGroup = $customFieldGroup;
return $this;
}
/**
* Get customFieldGroup
*
* @return \CL\CustomFieldsBundle\Entity\CustomFieldsGroup
*/
public function getCustomFieldGroup()
{
return $this->customFieldGroup;
}
}

View File

@@ -0,0 +1,146 @@
<?php
namespace CL\CustomFieldsBundle\Entity;
/**
* CustomFieldGroup
*/
class CustomFieldsGroup
{
/**
* @var integer
*/
private $id;
/**
* @var array
*/
private $name;
/**
* @var string
*/
private $entity;
/**
* @var \Doctrine\Common\Collections\Collection
*/
private $customFields;
/**
* Constructor
*/
public function __construct()
{
$this->customFields = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add customField
*
* @param \CL\CustomFieldsBundle\Entity\CustomField $customField
*
* @return CustomFieldsGroup
*/
public function addCustomField(\CL\CustomFieldsBundle\Entity\CustomField $customField)
{
$this->customFields[] = $customField;
return $this;
}
/**
* Remove customField
*
* @param \CL\CustomFieldsBundle\Entity\CustomField $customField
*/
public function removeCustomField(\CL\CustomFieldsBundle\Entity\CustomField $customField)
{
$this->customFields->removeElement($customField);
}
/**
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getCustomFields()
{
return $this->customFields;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param array $name
*
* @return CustomFieldsGroup
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return array
*/
public function getName($language = null)
{
//TODO set this in a service, PLUS twig function
if ($language) {
if (isset($this->name[$language])) {
return $this->name[$language];
} else {
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
}
return '';
} else {
return $this->name;
}
}
/**
* Set entity
*
* @param string $entity
*
* @return CustomFieldsGroup
*/
public function setEntity($entity)
{
$this->entity = $entity;
return $this;
}
/**
* Get entity
*
* @return string
*/
public function getEntity()
{
return $this->entity;
}
}