The following example shows how we can reflect on an empty Employee
data object.
<?php
// Create the employee data object (e.g. from an XML Data Access Service)
$employee = ...;
$reflection = new SDO_Model_ReflectionDataObject($employee);
print($reflection);
?>
Результат выполнения данного примера:
object(SDO_Model_ReflectionDataObject)#4 { - ROOT OBJECT - Type {
companyNS:EmployeeType[3] { commonj.sdo:String $name;
commonj.sdo:String $SN; commonj.sdo:Boolean $manager; } }
Using print on the SDO_Model_ReflectionDataObject writes out the data
object's model. We can see from the output how the type
companyNS:EmployeeType has three properties and we can see the names
of the properties along with their types. Note, the primitive types
are listed as SDO types (e.g. commonj.sdo namespace, String type).
It is worth noting that this is the SDO model and when these are
surfaced to an application they can be treated as the PHP equivalent
types (e.g. string and boolean).