\Pluf_Model_Set

Allow to iterate over an array of standard classes with 'model_class' and 'model_id' properties set.

Optional properties from the classses can also be extracted and added as properties to the model.

Suppose you have a $data array with: array( (object) array('model_class' => 'MyApp_Item', 'model_id' => 32, 'foo' => 'bingo plus'), (object) array('model_class' => 'MyApp_Bong', 'model_id' => 12, 'foo' => 'youpla'), (object) array('model_class' => 'MyApp_Item', 'model_id' => 14, 'foo' => 'bingo'), );

You can do: $set = new Pluf_Model_Set($data, array('foo' => '_Foo')); foreach ($set as $res) { echo $res; // Will be the loaded model based on the class and id. echo $res->_Foo; // will contain the value foo of the $data array. }

Summary

Methods
Properties
Constants
__construct()
current()
key()
next()
rewind()
valid()
count()
offsetUnset()
offsetSet()
offsetGet()
offsetExists()
No public properties found
No constants found
No protected methods found
$data
$keys
N/A
No private methods found
No private properties found
N/A

Properties

$data

$data : 

Type

$keys

$keys : 

Type

Methods

__construct()

__construct(  $data,   $keys = array()) 

Parameters

$data
$keys

current()

current() 

Get the current item.

key()

key() 

next()

next() 

rewind()

rewind() 

valid()

valid() 

count()

count() 

offsetUnset()

offsetUnset(  $index) 

Parameters

$index

offsetSet()

offsetSet(  $index,   $value) 

Parameters

$index
$value

offsetGet()

offsetGet(  $index) 

Parameters

$index

offsetExists()

offsetExists(  $index) 

Parameters

$index