Jump to content

Recommended Posts

Hi,

 

I'd like to access a protected object parameter but I simply can't figure it out how. I'll attach the file in witch if I var_dump the $this variable from the function getData() I get something like...

bject(ModRokSprocket)#1098 (4) {  ["params":protected]=>  object(RokCommon_Registry)#1061 (1) {    ["data":protected]=>    object(stdClass)#1058 (31) {      ["run_content_plugins"]=>      string( "onmodule"      ["provider"]=>      string(6) "joomla"      ["layout"]=>      string( "features"      ["joomla_articles"]=>      object(stdClass)#1051 (7) {        ["1"]=>        object(stdClass)#1077 (1) {          ["root"]=>          object(stdClass)#935 (1) {            ["article"]=>            string(1) "3"          }        }        ["2"]=>        object(stdClass)#1052 (1) {          ["root"]=>          object(stdClass)#1004 (1) {            ["article"]=>            string(1) "4"          }        }

My question is how could I unset the $this->joomla_articles[1] for examle. I've read that the protected object can be accessed from the class itself but I really can't figure it out how.

ModRokSprocket.php

Edited by szbztz
Link to comment
https://forums.phpfreaks.com/topic/297305-how-to-access-protected-object/
Share on other sites

Assuming you don't have a problem getting to the "params" property,

 

The RokCommon_Registry class controls access to its "data" property. An educated guess says that the class will have some method you can call to get the "joomla_articles" value. Get it, unset what you want to unset, then use a corresponding method to set the value back.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.