Shanty-Mongo icon indicating copy to clipboard operation
Shanty-Mongo copied to clipboard

Notice: Indirect modification of overloaded property

Open valeeum opened this issue 12 years ago • 2 comments

Hi All,

When I attempt to do the following operation:

$elb = new Elb();
$instanceId = 'someID';
$elb->instances->$instanceId = new Shanty_Mongo_Document(); $elb->instances->$instanceId->desc = 'some desc'; $elb->instances->$instanceId->state = 'some state'; $elb->save();

I get the following php error:

Notice: Indirect modification of overloaded property

Is there any way around this?

valeeum avatar Sep 24 '12 23:09 valeeum

Hi Valeeum,

I would sugest you try accessing your sub document like this:

$elb->instances[$instanceId]

Coen

coen-hyde avatar Sep 25 '12 00:09 coen-hyde

Same issue. One workaround is building an $instances document and then setting:

$elb->instances = $instances;

But I would love if there would be a consistent way of doing this so that I can dynamically do this stuff in loops.

valeeum avatar Sep 25 '12 00:09 valeeum