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:
Keyword

Class TPropertyAccess


TPropertyAccess class provides dot notation stype property access and setting.

Access object's properties (and subproperties) using dot path notation. The following are equivalent.

  1. echo $obj->property1;
  2. echo $obj->getProperty1();
  3. echo $obj['property1']; //$obj may be an array or object
  4. echo TPropertyAccess($obj, 'property1');

Setting a property value.

  1. $obj1->propert1 = 'hello';
  2. $obj->setProperty('hello');
  3. $obj['property1'] = 'hello'; //$obj may be an array or object
  4. TPropertyAccess($obj, 'property1', 'hello');

Subproperties are supported using the dot notation. E.g.

  1. echo $obj->property1->property2->property3
  2. echo TPropertyAccess::get($obj, 'property1.property2.property3');

Since: 3.1
Author: Wei Zhuo <weizho[at]gmail[dot]com>

Method Summary
mixed
get ( mixed $object, string $path)
Gets the property value.
boolean
has ( mixed $object, string $path)
void
set ( mixed &$originalObject, string $path, mixed $value)
Sets the property value.

Method Details

get

public mixed get (mixed $object , string $path )

Gets the property value.

Input
mixed$objectobject or path.
string$pathproperty path.
Output
mixed property value.
Exception
throwsTInvalidDataValueException if property path is invalid.

has

public boolean has (mixed $object , string $path )

Input
mixed$objectobject or array
string$pathproperty path.
Output
boolean true if property path is valid
Exception

set

public void set (mixed &$originalObject , string $path , mixed $value )

Sets the property value.

Input
mixed&$originalObjectobject or array
string$pathproperty path.
mixed$valuenew property value.
Output
Exception
throwsTInvalidDataValueException if property path is invalid.