0

Ive been working with some code and I am recieving a var (I didnt work the entire code, so, I dont know how it was made), my problem is that I get something like this

AdminUserRoleDecorator Object (
    [user:AdminUserRoleDecorator:private] => EssUserRoleDecorator Object (
        [user:EssUserRoleDecorator:private] => User Object (
            [topMenuItemsArray:User:private] => Array ( )
            [employeeList:User:private] => Array ( )
            [activeProjectList:User:private] => Array ( )
            [empNumber:User:private] => [allowedActions:User:private] => Array ( )
            [nextState:User:private] => [userId:User:private] => 1
            [userTimeZoneOffset:User:private] => -6 

To be honest, and It could sound like a very stupid question, I dont know how to read that, normally I get the atributes in the way $myobject->atribute , now this I really have no idea, any way I can access to this? for example, I want to get the userId, I see its there, with :user:private (which I also dont know what are they for).

If I try

$myobject->User; 

for example, I get nothing back.

Thanks.

EDIT:

I tried $myobject->user

and I am getting this

Fatal error: Cannot access private property AdminUserRoleDecorator

I am working with symfony by the way.

1 Answers1

0

From the answer I gave here, you can get some insight into objects with get_class_methods() (php reference) and get_class_vars(). On that post, I made up a function to help me learn more about class methods available:

show_methods($playlistListFeed);

function show_methods( $_a ) {
    echo "<h3>Methods for ".get_class($_a)."</h3>";
    $_a= get_class_methods($_a);
    $_a=array_unique($_a);
    array_multisort(&$_a);
    $i=0;
    foreach( $_a as $method ) {
        $i++;
        printf("%-30.30s",$method);
        if($i%5==0)
            echo "\n";
    }
}
Community
  • 1
  • 1
Krista K
  • 21,503
  • 3
  • 31
  • 43