1

I'm drawing a blank for some reason on how to access this information in an object (It's a Zend_Db_Table_Row, but I think that's beside the point). Here's the print_r, I'd like to get just the array assigned to [_data:protected]

MyClassName Object
(
[_data:protected] => Array
    (
        [param1] => 1
        [param2] => Some info
        [param3] => ....
    )

... lots more unneeded info such as 'cleandata' and table schema information

I know I can access all the data using $instance->param1, etc, but I'm assigning it to a session and would like to just be able to say

$sessionNamespace = $instance->data;

...as to not store the table schema info and not have to iterate through the array and assign it manually. Thanks.

2 Answers 2

5

what about Zend_Db_Table_Row::toArray()?

Sign up to request clarification or add additional context in comments.

Comments

1

Because it has :protected, means it has been declared protected and therefore you can't access it. The actual class, or a class derived from it (that extends it) has to pass it to you with a function call.

You might want to check the API for a getData() type method that returns all the data, or serialize() if the object supports serialization.

Edit: And there one is: As Zerkms suggested, you can use toArray() to access it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.