Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6872529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:56:22+00:00 2026-05-27T03:56:22+00:00

In our backoffice we have a core-system that generates models from the DB. When

  • 0

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
                )
        )
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:56:23+00:00Added an answer on May 27, 2026 at 3:56 am

    I’ve figured it out. In my case I’ve created a function that returns the stdObject of a Decoarator object. In my Controller_Core-class I’ve made function that recursively handles a given object and returns the whole structure as one stdClass.

    My code, if it is helpful to someone:

    /**
     * Controller_Core::RevertToStdClass
     *
     * @params: Decorator   $oObject
     * @return: stdClass    $oObject
     **/
    public function RevertToStdClass(Decorator $oObject)
    {   
        if(is_a($oObject, "Decorator"))
        {
            $oObject = $oObject->ReturnStdObject();
        }
    
        $aProperties = get_object_vars($oObject);
    
        foreach($aProperties as $sProperty => $mValue)
        {
            if(is_array($mValue))
            {
                foreach($mValue as $mIndex => $mSubValue)
                {
                    if(is_a($mSubValue, "Decorator"))
                    {
                        $oObject->{$sProperty}[$mIndex] = $this->RevertToStdClass($mSubValue);
                    }
                }
            }
            else
            {
                if(is_a($mValue, "Decorator"))
                {
                    $oObject->{$sProperty} = $this->RevertToStdClass($oObject->{$sProperty});
                }
            }
        }
    
        return $oObject;    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As part of one our system's we enable a user in the backoffice to
I have a store (C#) that calls our back office(ASP classic) via a one-pixel
We have a bit of a messy database situation. Our main back-office system is
Our team is creating a new recruitment workflow system to replace an old one.
We have an integrated system (at least is that what we call it), which
Our system using HttpContext.Current.Session(Client) to store the current user info. One property in the
Our infrastructure guys have told me that it's not possible to assign SSL Cert.
Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding
Our dev shop currently uses Visual SourceSafe. We all know how that could end
Our EPOS system copies data by compressing the database into a zip file, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.