mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Adding method getActiveCustomFields
This commit is contained in:
parent
5583fbcc6c
commit
9f98c4e7e6
@ -21,6 +21,8 @@
|
||||
|
||||
namespace Chill\CustomFieldsBundle\Entity;
|
||||
|
||||
use \Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
* CustomFieldGroup
|
||||
*/
|
||||
@ -42,9 +44,18 @@ class CustomFieldsGroup
|
||||
private $entity;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\Collection
|
||||
* @var \Doctrine\Common\Collections\Collection $customFields: The custom
|
||||
* fields of the group. The custom fields are asc-ordered regarding to their
|
||||
* property "ordering".
|
||||
*/
|
||||
private $customFields;
|
||||
|
||||
/**
|
||||
* @var array(customField) | null $activeCustomFields: The custom fields
|
||||
* of the group that are active. This variable if null, if this
|
||||
* informations has not been computed.
|
||||
*/
|
||||
private $activeCustomFields = null;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -52,7 +63,7 @@ class CustomFieldsGroup
|
||||
*/
|
||||
private $options = array();
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
@ -93,6 +104,25 @@ class CustomFieldsGroup
|
||||
return $this->customFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the custom
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getActiveCustomFields()
|
||||
{
|
||||
if($this->activeCustomFields === null) {
|
||||
$this->activeCustomFields = array();
|
||||
foreach ($this->customFields as $cf) {
|
||||
if($cf->isActive()) {
|
||||
array_push($this->activeCustomFields, $cf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->activeCustomFields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
@ -189,7 +219,4 @@ class CustomFieldsGroup
|
||||
$this->options = $options;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user