Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_ArrayIteratorItem class

• Introduction

Module array item model.

• Class synopsis

AMI_ArrayIteratorItem implements AMI_iFormModTableItem, AMI_iModTableItem {
/* Properties */
// Item search conditions
protected array $aCondition = array();
// Element data
protected array $aData = array();
// Field callbacks
protected array $aFieldCallbacks = array();
// Fields to load
protected array $aFields = array();
// Iterator pointer
protected int $dataIndex = -1;
// Element id value
protected int|string $id;
// Iterator model
// Primary key field name
protected string $primaryKeyField = 'id';
/* Methods */
// Initializing array item data.
public __construct ( AMI_ArrayIterator $oIterator, [ $aData = array() ], [ $aFields = array() ] ) returns AMI_ArrayIteratorItem;
// Adds item search condition.
public addSearchCondition ( $aCondition ) returns AMI_ArrayIteratorItem;
// Returns the current element.
public current ( ) returns mixed;
// Returns data array.
public getData ( ) returns array;
// Returns current item primary key value.
public getId ( ) returns mixed;
// Returns module id.
public getModId ( ) returns string;
// Returns primary key field name.
public getPrimaryKeyField ( ) returns string;
// Returns raw data array.
public getRawData ( ) returns array;
// Returns validator exception object validator after save or null.
// Returns validators.
public getValidators ( ) returns array;
// Returns field value from data array.
public getValue ( string $name ) returns mixed;
// Checks if the field has a specified callback.
public hasFieldCallback ( string $field, callback $callback ) returns bool;
// Returns the key of the current element.
public key ( ) returns mixed;
// Loads data.
public load ( ) returns AMI_ArrayIteratorItem;
// Move forward to next element.
public next ( ) returns void;
// Rewinds the Iterator to the first element.
public rewind ( ) returns void;
// Sets field callback on AMI_ArrayIteratorItem::__get() and AMI_ArrayIteratorItem::__set().
public setFieldCallback ( string $field, callback $callback ) returns AMI_ArrayIteratorItem;
// Set module id.
public setModId ( mixed $id ) returns void;
// Sets field value in data array.
public setValue ( string $name, mixed $value ) returns AMI_ArrayIteratorItem;
// Sets model values from array.
public setValues ( $aData ) returns AMI_ArrayIteratorItem;
// Checks if current position is valid.
public valid ( ) returns bool;
// Property access getter.
public __get ( string $name ) returns mixed;
// Property access getter.
public __isset ( string $name ) returns bool;
// Property access setter.
public __set ( string $name, string $value ) returns void;
// Property access setter.
public __unset ( string $name ) returns void;
// Calls field callbacks.
protected _useFieldCallback ( string $action, string $name, mixed &$value ) returns bool;
}
Tags:
abstract
since 5.14.8

• Class Properies

protected array $aCondition

Item search conditions

protected array $aData

Element data

protected array $aFieldCallbacks

Field callbacks

protected array $aFields

Fields to load

protected int $dataIndex

Iterator pointer

protected int|string $id

Element id value

protected AMI_ArrayIterator $oIterator

Iterator model

protected string $primaryKeyField

Primary key field name

• Class Methods

// Initializing array item data.
public __construct ( AMI_ArrayIterator $oIterator, [ $aData = array() ], [ $aFields = array() ] ) returns AMI_ArrayIteratorItem;
  • AMI_ArrayIterator $oIterator
    Array iterator model
  • array $aData
    Set of data
  • array $aFields
    Set of fields
// Adds item search condition.
public addSearchCondition ( $aCondition ) returns AMI_ArrayIteratorItem;
  • array $aCondition
    Item search condition - array(field => value)
// Returns the current element.
public current ( ) returns mixed;
Iterator interface implementation.
// Returns data array.
public getData ( ) returns array;

Implementation of: AMI_iModTableItem::getData().

// Returns current item primary key value.
public getId ( ) returns mixed;

Implementation of: AMI_iFormModTableItem::getId().

// Returns module id.
public getModId ( ) returns string;

Implementation of: AMI_iModTableItem::getModId().

Overridden in child classes as: AMI_ModSpecblock_ArrayIteratorItem::getModId().

// Returns primary key field name.
public getPrimaryKeyField ( ) returns string;
// Returns raw data array.
public getRawData ( ) returns array;

Implementation of: AMI_iModTableItem::getRawData().

// Returns validator exception object validator after save or null.
// Returns validators.
public getValidators ( ) returns array;
// Returns field value from data array.
public getValue ( string $name ) returns mixed;
  • string $name
    Field name

Implementation of: AMI_iFormModTableItem::getValue().

// Checks if the field has a specified callback.
public hasFieldCallback ( string $field, callback $callback ) returns bool;
  • string $field
    Field name
  • callback $callback
    Formatter callback
// Returns the key of the current element.
public key ( ) returns mixed;
Iterator interface implementation.
// Loads data.
public load ( ) returns AMI_ArrayIteratorItem;

Implementation of: AMI_iModTableItem::load().

// Move forward to next element.
public next ( ) returns void;
Iterator interface implementation.
// Rewinds the Iterator to the first element.
public rewind ( ) returns void;
Iterator interface implementation.
// Sets field callback on AMI_ArrayIteratorItem::__get() and AMI_ArrayIteratorItem::__set().
public setFieldCallback ( string $field, callback $callback ) returns AMI_ArrayIteratorItem;
  • string $field
    Field name
  • callback $callback
    Formatter callback

Implementation of: AMI_iModTableItem::setFieldCallback().

Used for computational/virtual fields or to convert field value from/to internal/external format.
// Set module id.
public setModId ( mixed $id ) returns void;
  • mixed $id
    Module Id.
// Sets field value in data array.
public setValue ( string $name, mixed $value ) returns AMI_ArrayIteratorItem;
  • string $name
    Field name
  • mixed $value
    Field value
// Sets model values from array.
public setValues ( $aData ) returns AMI_ArrayIteratorItem;
  • array $aData
    Data array
// Checks if current position is valid.
public valid ( ) returns bool;
Iterator interface implementation.
// Property access getter.
public __get ( string $name ) returns mixed;
  • string $name
    Property name
Returns value from data array.
// Property access getter.
public __isset ( string $name ) returns bool;
  • string $name
    Property name
Check if key is exists in data array.
// Property access setter.
public __set ( string $name, string $value ) returns void;
  • string $name
    Property name
  • string $value
    Property value
Sets value to data array.
// Property access setter.
public __unset ( string $name ) returns void;
  • string $name
    Property name
Unsets value in data array by key.
// Calls field callbacks.
protected _useFieldCallback ( string $action, string $name, mixed &$value ) returns bool;
  • string $action
    Action 'get'|'set'
  • string $name
    Field name
  • mixed &$value
    Field value