NAVIGATION IN THE COMPONENT TREE

Every node in the component tree is represented by a Kwf_Component_Data object. This object is not the component itself (mainly for performance reasons to allow lazy loading).

Access Component

Every Data object has a 1:1 relation to the component object:

Data Properties

Data objects are created by generators and the generators set various properties on them:

Data objects created by page generators have the following additional properties:

Data objects created by table generators have the following additional properties:

Parent Data

A data object always knows about it's parents, accessing them is cheap as they usually exist in memory: $data->parent

Various helper methods exist:

Kwf_Component_Select

When accessing the component tree, a select object can be used to filter the result. Think of it like an WHERE part in sql statements.

Other not so commonly used methods:

Array form

As creating an select object requires quite some code there is also a convenience short form for passing a select:

$s = new Kwf_Component_Select();
$s->whereComponentClass('Example_Component');
//can be written as:
$s = array('componentClass' => 'Example_Component')

All other where...() methods are supported.

Other special forms: array('ignoreVisible'=>true), array('limit'=>1)

Model select

Kwf_Component_Select inherits Kwf_Model_Select, so all those methods are also supported and used by table generators. Using that you can filter by any column existing in a model that is used by a table generator.

Examples:

$foo->getChildComponents(array('componentClass'=>'Example_Component'));

.

s = new Kwf_Component_Select();
$s->whereComponentClass('Example_Component');
$foo->getChildComponents($s);

.

$foo->getChildComponents(array('flag'=>'test'));

Child Data

There are various ways to access child data. When accessing a table generator a database query has to be made. If you get hundreds of data objects this will obviously require memory.

Other Methods

Root Component

The root component is the starting point of the component tree. There exists exactly one object per web and it can be accessed using: $root = Kwf_Component_Data_Root::getInstance();

Other helper methods