- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
TBrowserLogRoute
TDataFieldAccessor
TDateTimeStamp
TDbLogRoute
TEmailLogRoute
TFileLogRoute
TFirebugLogRoute
TFirePhpLogRoute
TLogger
TLogRoute
TLogRouter
TParameterModule
TSimpleDateFormatter
TVarDumper

Keyword

# Class TDataFieldAccessor

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 sub-property defined with getter methods. For example, if the object has a method called getMyValue(), then field 'MyValue' will retrieve 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
Author: Qiang Xue <qiang.xue@gmail.com>

Method Summary
mixed | getDataFieldValue ( mixed $data, mixed $field) Evaluates the data value at the specified field.

Method Details

## getDataFieldValue

public mixed getDataFieldValue | (mixed $data , mixed $field )

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 sub-property defined with getter methods. For example, if the object has a method called getMyValue(), then field 'MyValue' will retrieve 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.

Input
mixed | $data | data containing the field value, can be an array, TMap, TList or object.
mixed | $field | field value
Output
mixed | value at the specified field
Exception
throws | TInvalidDataValueException if field or data is invalid