stdClass Object ( [XXXXX] => stdClass Object ( [id] => 111111 [name] => XXXXX ) )
$name = $ob->XXXXX->name;
$id = $ob->XXXXX->id;
$foo = new Foo();
$reflect = new ReflectionClass($foo);
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
$names = array();
$ids = array();
foreach($props as $property){
$propName = $property->getName();
$names[] = $object->$propName->name;
$ids[] = $object->$propName->id;
}