In our backoffice we have a core-system that generates models from the DB. When returning one object we make an instance of stdClass. All the columns from the query-result are set as proprties and when finished processing the query-result the stdClass-object is converted into a (we call it) Decorator-class. Basically the Decorator-class has one proprty $_oObject where the stdClass is stored into. We do this gain control over dynamically created objects. This works all fine.
However, I'm working on a webserver using SOAP. The webservice returns the whole Decorator-object (could possibly have sub-objects, also being Decorator objects, and sub-sub object.. and so on). This structure works perfectly fine with our internal system because we have control over the Decorator-object but for the outside world I want to revert the Decorator-object-structure into a stdClass instance with sub-classes also being stdClasses. Basically I want to remove all the 'nodes' in the print_r-result containing Decorator.
Any ideas how to achieve what I want (see results below). PHP's get_object_vars
doesn't return anything and actually I'm stuck..
My sample data:
Decorator Object
(
[oClass:Decorator:private] => stdClass Object
(
[Id] => 1
[FAQCategoryId] => 1
[TitleId] => 1
[ContentId] => 2
[Views] => 226
[DateCreated] => 2011-10-31 11:17:44
[DateModified] =>
[Title] => My title..
[Content] => My content..
[AttachmentSet] => Array
(
[0] => Decorator Object
(
[oClass:Decorator:private] => stdClass Object
(
[Id] => 1
[LanguageId] => 1
[FAQItemId] => 1
[Attachment] => file1.pdf
)
)
[1] => Decorator Object
(
[oClass:Decorator:private] => stdClass Object
(
[Id] => 2
[LanguageId] => 1
[FAQItemId] => 1
[Attachment] => file2.pdf
)
)
)
)
)
I want to convert it into:
stdClass Object
(
[Id] => 1
[FAQCategoryId] => 1
[TitleId] => 1
[ContentId] => 2
[Views] => 226
[DateCreated] => 2011-10-31 11:17:44
[DateModified] =>
[Title] => My title..
[Content] => My content..
[AttachmentSet] => Array
(
[0] => stdClass Object
(
[Id] => 1
[LanguageId] => 1
[FAQItemId] => 1
[Attachment] => file1.pdf
)
[1] => stdClass Object
(
[Id] => 2
[LanguageId] => 1
[FAQItemId] => 1
[Attachment] => file2.pdf
)
)
)