Class TPropertyAccess

Description

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
  • version: $Id: TPropertyAccess.php 2382 2008-02-26 15:08:19Z tof $
  • author: Wei Zhuo <weizho[at]gmail[dot]com>

Located in /Data/SqlMap/DataMapper/TPropertyAccess.php (line 44)


	
			
Method Summary
mixed get (mixed $object, string $path)
boolean has (mixed $object, string $path)
void set (mixed &$originalObject, string $path, mixed $value)
Methods
get (line 53)

Gets the property value.

  • return: property value.
  • static:
  • access: public
  • throws: TInvalidDataValueException if property path is invalid.
mixed get (mixed $object, string $path)
  • mixed $object: object or path.
  • string $path: property path.
has (line 88)
  • return: true if property path is valid
  • static:
  • access: public
boolean has (mixed $object, string $path)
  • mixed $object: object or array
  • string $path: property path.
set (line 124)

Sets the property value.

  • static:
  • access: public
  • throws: TInvalidDataValueException if property path is invalid.
void set (mixed &$originalObject, string $path, mixed $value)
  • mixed &$originalObject: object or array
  • string $path: property path.
  • mixed $value: new property value.

Documentation generated on Mon, 21 Apr 2008 11:35:54 -0400 by phpDocumentor 1.3.0RC4