ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
arFieldList Class Reference

Class arFieldList. More...

+ Collaboration diagram for arFieldList:

Public Member Functions

 getArrayForConnector ()
 getFieldByName ($field_name)
 isField ($field_name)
 getPrimaryFieldName ()
 getPrimaryFieldType ()
 setFields ($fields)
 getFields ()
 setPrimaryField ($primary_field)
 getPrimaryField ()
 setRawFields ($raw_fields)
 getRawFields ()
 setPrimaryFields ($primary_fields)
 getPrimaryFields ()

Static Public Member Functions

static mapKey ($key)
static getAllowedConnectorFields ()
static getAllowedDescriptionFields ()
static getInstance (ActiveRecord $ar)
static getInstanceFromStorage ($ar)

Data Fields

const HAS_FIELD = 'has_field'
const IS_UNIQUE = 'is_unique'
const IS_PRIMARY = 'is_primary'
const IS_NOTNULL = 'is_notnull'
const FIELDTYPE = 'fieldtype'
const LENGTH = 'length'
const SEQUENCE = 'sequence'
const INDEX = 'index'

Protected Member Functions

 initFields ()
 initRawFields (arStorageInterface $ar)

Static Protected Member Functions

static isAllowedAttribute ($attribute_name)
static checkAttributes (array $attributes)

Protected Attributes

 $primary_field
 $primary_fields = array()
 $raw_fields = array()
 $fields = array()

Static Protected Attributes

static $prefixes = array( 'db', 'con' )
static $protected_names = array( 'arConnector', 'arFieldList' )
static $allowed_description_fields
static $allowed_connector_fields
static $key_maps

Detailed Description

Class arFieldList.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
2.0.7

Definition at line 11 of file class.arFieldList.php.

Member Function Documentation

static arFieldList::checkAttributes ( array  $attributes)
staticprotected
Parameters
array$attributes
Returns
bool

Definition at line 260 of file class.arFieldList.php.

{
if ($attributes[self::HAS_FIELD] === 'true') {
foreach (array_keys($attributes) as $atr) {
if (!self::isAllowedAttribute($atr)) {
return false;
}
}
} else {
return false;
}
return true;
}
static arFieldList::getAllowedConnectorFields ( )
static
Returns
array

Definition at line 91 of file class.arFieldList.php.

References $allowed_connector_fields.

Referenced by arField\getAttributesForConnector().

+ Here is the caller graph for this function:

static arFieldList::getAllowedDescriptionFields ( )
static
Returns
array

Definition at line 99 of file class.arFieldList.php.

References $allowed_description_fields.

Referenced by arField\getAttributesForDescription().

+ Here is the caller graph for this function:

arFieldList::getArrayForConnector ( )
Returns
array

Definition at line 136 of file class.arFieldList.php.

References getFields().

{
$return = array();
foreach ($this->getFields() as $field) {
$return[$field->getName()] = $field->getAttributesForConnector();
}
return $return;
}

+ Here is the call graph for this function:

arFieldList::getFieldByName (   $field_name)
Parameters
$field_name
Returns
arField

Definition at line 166 of file class.arFieldList.php.

References getFields().

{
$field = NULL;
static $field_map;
if ($field_map[$field_name]) {
return $field_map[$field_name];
}
foreach ($this->getFields() as $field) {
if ($field->getName() == $field_name) {
$field_map[$field_name] = $field;
return $field;
}
}
}

+ Here is the call graph for this function:

arFieldList::getFields ( )
Returns
arField[]

Definition at line 286 of file class.arFieldList.php.

References $fields.

Referenced by getArrayForConnector(), getFieldByName(), and isField().

{
return $this->fields;
}

+ Here is the caller graph for this function:

static arFieldList::getInstance ( ActiveRecord  $ar)
static
Parameters
ActiveRecord$ar
Returns

Definition at line 109 of file class.arFieldList.php.

Referenced by arFieldCache\store().

{
$arFieldList = new self();
$arFieldList->initRawFields($ar);
$arFieldList->initFields();
return $arFieldList;
}

+ Here is the caller graph for this function:

static arFieldList::getInstanceFromStorage (   $ar)
static
Parameters
ActiveRecord$ar
Deprecated:
Returns

Definition at line 124 of file class.arFieldList.php.

Referenced by arFieldCache\storeFromStorage().

{
$arFieldList = new self();
$arFieldList->initRawFields($ar);
$arFieldList->initFields();
return $arFieldList;
}

+ Here is the caller graph for this function:

arFieldList::getPrimaryField ( )
Returns

Definition at line 302 of file class.arFieldList.php.

References $primary_field.

Referenced by getPrimaryFieldName(), and getPrimaryFieldType().

{
}

+ Here is the caller graph for this function:

arFieldList::getPrimaryFieldName ( )
Returns
string

Definition at line 202 of file class.arFieldList.php.

References getPrimaryField().

{
return $this->getPrimaryField()->getName();
}

+ Here is the call graph for this function:

arFieldList::getPrimaryFields ( )
Returns
array

Definition at line 334 of file class.arFieldList.php.

References $primary_fields.

{
}
arFieldList::getPrimaryFieldType ( )
Returns
mixed

Definition at line 210 of file class.arFieldList.php.

References getPrimaryField().

{
return $this->getPrimaryField()->getFieldType();
}

+ Here is the call graph for this function:

arFieldList::getRawFields ( )
Returns
array

Definition at line 318 of file class.arFieldList.php.

References $raw_fields.

Referenced by initFields().

{
}

+ Here is the caller graph for this function:

arFieldList::initFields ( )
protected

Definition at line 146 of file class.arFieldList.php.

References fields, getRawFields(), and setPrimaryField().

{
foreach ($this->getRawFields() as $fieldname => $attributes) {
if (self::checkAttributes($attributes)) {
$arField = new arField();
$arField->getHasField(true);
$arField->loadFromArray($fieldname, $attributes);
$this->fields[] = $arField;
if ($arField->getPrimary()) {
$this->setPrimaryField($arField);
}
}
}
}

+ Here is the call graph for this function:

arFieldList::initRawFields ( arStorageInterface  $ar)
protected
Parameters
\ActiveRecord | \arStorageInterface$ar
Returns
array

Definition at line 220 of file class.arFieldList.php.

References $protected_names, $raw_fields, and setRawFields().

{
$regex = "/[ ]*\\* @(" . implode('|', self::$prefixes) . ")_([a-zA-Z0-9_]*)[ ]*([a-zA-Z0-9_]*)/u";
$reflectionClass = new ReflectionClass($ar);
$raw_fields = array();
foreach ($reflectionClass->getProperties() as $property) {
if (in_array($property->getName(), self::$protected_names)) {
continue;
}
$properties_array = array();
$has_property = false;
foreach (explode("\n", $property->getDocComment()) as $line) {
if (preg_match($regex, $line, $matches)) {
$has_property = true;
$properties_array[(string)$matches[2]] = $matches[3];
}
}
if ($has_property) {
$raw_fields[$property->getName()] = $properties_array;
}
}
}

+ Here is the call graph for this function:

static arFieldList::isAllowedAttribute (   $attribute_name)
staticprotected
Parameters
$attribute_name
Returns
bool

Definition at line 250 of file class.arFieldList.php.

{
return in_array($attribute_name, array_merge(self::$allowed_description_fields, array( self::HAS_FIELD )));
}
arFieldList::isField (   $field_name)
Parameters
$field_name
Returns
bool

Definition at line 187 of file class.arFieldList.php.

References getFields().

{
$is_field = false;
foreach ($this->getFields() as $field) {
if ($field->getName() == $field_name) {
$is_field = true;
}
}
return $is_field;
}

+ Here is the call graph for this function:

static arFieldList::mapKey (   $key)
static
Parameters
$key
Returns
mixed

Definition at line 79 of file class.arFieldList.php.

Referenced by arBuilder\generateDBUpdateForInstallation(), arField\getAttributesForConnector(), and arField\getAttributesForDescription().

{
if (isset(self::$key_maps[$key])) {
return self::$key_maps[$key];
}
return $key;
}

+ Here is the caller graph for this function:

arFieldList::setFields (   $fields)
Parameters
array$fields

Definition at line 278 of file class.arFieldList.php.

References $fields, and fields.

{
$this->fields = $fields;
}
arFieldList::setPrimaryField (   $primary_field)
Parameters
\arField$primary_field

Definition at line 294 of file class.arFieldList.php.

References $primary_field.

Referenced by initFields().

{
$this->primary_field = $primary_field;
}

+ Here is the caller graph for this function:

arFieldList::setPrimaryFields (   $primary_fields)
Parameters
array$primary_fields

Definition at line 326 of file class.arFieldList.php.

References $primary_fields.

{
$this->primary_fields = $primary_fields;
}
arFieldList::setRawFields (   $raw_fields)
Parameters
array$raw_fields

Definition at line 310 of file class.arFieldList.php.

References $raw_fields.

Referenced by initRawFields().

{
$this->raw_fields = $raw_fields;
}

+ Here is the caller graph for this function:

Field Documentation

arFieldList::$allowed_connector_fields
staticprotected
Initial value:
array(
self::IS_NOTNULL,
self::FIELDTYPE,
self::LENGTH,
)

Definition at line 44 of file class.arFieldList.php.

Referenced by getAllowedConnectorFields().

arFieldList::$allowed_description_fields
staticprotected
Initial value:
array(
self::IS_UNIQUE,
self::IS_PRIMARY,
self::IS_NOTNULL,
self::FIELDTYPE,
self::LENGTH,
self::SEQUENCE,
self::INDEX,
)

Definition at line 32 of file class.arFieldList.php.

Referenced by getAllowedDescriptionFields().

arFieldList::$fields = array()
protected

Definition at line 64 of file class.arFieldList.php.

Referenced by getFields(), and setFields().

arFieldList::$key_maps
staticprotected
Initial value:
array(
self::FIELDTYPE => 'type',
self::IS_NOTNULL => 'notnull',
)

Definition at line 68 of file class.arFieldList.php.

arFieldList::$prefixes = array( 'db', 'con' )
staticprotected

Definition at line 24 of file class.arFieldList.php.

arFieldList::$primary_field
protected

Definition at line 52 of file class.arFieldList.php.

Referenced by getPrimaryField(), and setPrimaryField().

arFieldList::$primary_fields = array()
protected

Definition at line 56 of file class.arFieldList.php.

Referenced by getPrimaryFields(), and setPrimaryFields().

arFieldList::$protected_names = array( 'arConnector', 'arFieldList' )
staticprotected

Definition at line 28 of file class.arFieldList.php.

Referenced by initRawFields().

arFieldList::$raw_fields = array()
protected

Definition at line 60 of file class.arFieldList.php.

Referenced by getRawFields(), initRawFields(), and setRawFields().

const arFieldList::FIELDTYPE = 'fieldtype'
const arFieldList::HAS_FIELD = 'has_field'
const arFieldList::INDEX = 'index'

Definition at line 20 of file class.arFieldList.php.

const arFieldList::IS_NOTNULL = 'is_notnull'

Definition at line 16 of file class.arFieldList.php.

Referenced by arConverter\returnAttributesForField().

const arFieldList::IS_PRIMARY = 'is_primary'

Definition at line 15 of file class.arFieldList.php.

Referenced by arConverter\returnAttributesForField().

const arFieldList::IS_UNIQUE = 'is_unique'

Definition at line 14 of file class.arFieldList.php.

Referenced by arConverter\returnAttributesForField().

const arFieldList::LENGTH = 'length'

Definition at line 18 of file class.arFieldList.php.

Referenced by arConverter\returnAttributesForField().

const arFieldList::SEQUENCE = 'sequence'

Definition at line 19 of file class.arFieldList.php.


The documentation for this class was generated from the following file: