## Class TDataFieldAccessor

Description

TDataFieldAccessor class

TDataFieldAccessor is a utility class that provides access to a field of some data. The accessor attempts to obtain the field value in the following order:

- If the data is an array, then the field is treated as an array index and the corresponding element value is returned;
- If the data is a TMap or TList object, then the field is treated as a key into the map or list, and the corresponding value is returned.
- If the data is an object, the field is treated as a property or subproperty defined with getter methods. For example, if the object has a method called getMyValue(), then field 'MyValue' will retrive the result of this method call. If getMyValue() returns an object which contains a method getMySubValue(), then field 'MyValue.MySubValue' will return that method call result.

- since: 3.0
- version: $Id: TDataFieldAccessor.php 1398 2006-09-08 19:31:03Z xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Util/TDataFieldAccessor.php (line 33)

Method Summary
mixed getDataFieldValue (mixed $data, mixed $field)
Methods
getDataFieldValue (line 51)

Evaluates the data value at the specified field.

- If the data is an array, then the field is treated as an array index and the corresponding element value is returned;
- If the data is a TMap or TList object, then the field is treated as a key into the map or list, and the corresponding value is returned.
- If the data is an object, the field is treated as a property or subproperty defined with getter methods. For example, if the object has a method called getMyValue(), then field 'MyValue' will retrive the result of this method call. If getMyValue() returns an object which contains a method getMySubValue(), then field 'MyValue.MySubValue' will return that method call result.

- return: value at the specified field
- static:
- access: public
- throws: TInvalidDataValueException if field or data is invalid

mixed getDataFieldValue (mixed $data, mixed $field)

- mixed $data: data containing the field value, can be an array, TMap, TList or object.
- mixed $field: field value

Documentation generated on Sun, 14 Jan 2007 21:41:53 -0500 by phpDocumentor 1.3.0RC4