KWeb  6.4
KWebCollection_Objects Class Reference

Objects (KWebObject) read from another data source. More...

Inheritance diagram for KWebCollection_Objects:
Collection_Outer Collection KWebCollection_Links

Public Member Functions

 __construct (Collection $collection, $objectGenreOrField, $objectIdField, array $options=array())
 current ()
 prefetch ($limit=false, $start=false)
 Items will be prefetched (if needed) in a batch for later retrieval.
 extractField ($data, $field, $default=null)
 isHandlingData ()
 Returns true if this collection is handling data (overrides current(), fetchField(), or extractField())

Static Public Member Functions

static createFromArray (array $data, array $options=array(), $objectGenreOrField=GENRE_ITEM, $objectIdField=false)
 Creates KWebCollection_Objects from array of ids, or array of arrays.
static createFromObjects (array $data, array $options=array())
 Creates KWebCollection_Objects from array of objects.

Data Fields

 $objectIdField = ""
 Field name in data with object's id, or false to use data as an id.
 $objectGenreField
 Field name in data with object's genre, or false to use $objectGenre.
 $objectGenre
 Objects genre, FALSE to treat object IDs as UIDs, or NULL if data is itself an KWebObject.

Protected Attributes

 $lastPrefetched = 0
 $lastReleased = 0

Detailed Description

Objects (KWebObject) read from another data source.

supports OPT_PREFETCH_AUTO and OPT_RELEASE_AUTO


Constructor & Destructor Documentation

KWebCollection_Objects::__construct ( Collection collection,
objectGenreOrField,
objectIdField,
array $  options = array() 
)
Parameters:
$dataSource of the data
$objectGenreOrFieldObjects genre, or data field containing the genre prefixed with '.'
$objectIdFieldData field containing the object id or name

Member Function Documentation

static KWebCollection_Objects::createFromArray ( array $  data,
array $  options = array(),
objectGenreOrField = GENRE_ITEM,
objectIdField = false 
) [static]

Creates KWebCollection_Objects from array of ids, or array of arrays.

// create from UIDs: KWebCollection_Objects::createFromArray(array('1,item', '2,comment'), array(), false, false);

// create from IDs: KWebCollection_Objects::createFromArray(array('1', '2'), array(), GENRE_ITEM, false);

// create from array of arrays: KWebCollection_Objects::createFromArray(array(array('genre' => 'item', 'id' => '1'), array('genre' => 'comment', 'id' => '2')), array(), '.genre', 'id');

Parameters:
$objectGenreOrField- object genre, object genre's field name prefixed with '.', or FALSE to treat id as UID
$objectIdField- object id's field name, or FALSE to treat data as id
Returns:
KWebCollection_Objects
static KWebCollection_Objects::createFromObjects ( array $  data,
array $  options = array() 
) [static]

Creates KWebCollection_Objects from array of objects.

Returns:
KWebCollection_Objects
KWebCollection_Objects::current ( )

Reimplemented from Collection_Outer.

KWebCollection_Objects::extractField ( data,
field,
default = null 
)
Parameters:
KWebObject$data

Reimplemented from Collection_Outer.

KWebCollection_Objects::isHandlingData ( )

Returns true if this collection is handling data (overrides current(), fetchField(), or extractField())

Returns:
boolean

Reimplemented from Collection_Outer.

KWebCollection_Objects::prefetch ( limit = false,
start = false 
)

Items will be prefetched (if needed) in a batch for later retrieval.

Parameters:
Numberof items to prefetch or false
Startof the prefetch or false for current position
Returns:
boolean TRUE if prefetch was successfull, FALSE if prefetch can't be supported

Reimplemented from Collection_Outer.

Reimplemented in KWebCollection_Links.


Field Documentation

KWebCollection_Objects::$lastPrefetched = 0 [protected]
KWebCollection_Objects::$lastReleased = 0 [protected]
KWebCollection_Objects::$objectGenre

Objects genre, FALSE to treat object IDs as UIDs, or NULL if data is itself an KWebObject.

KWebCollection_Objects::$objectGenreField

Field name in data with object's genre, or false to use $objectGenre.

KWebCollection_Objects::$objectIdField = ""

Field name in data with object's id, or false to use data as an id.


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