I have a dynamic class referenced by $row->attributes()
, that has some overloaded (dynamic) properties, e.g. $row->attributes()->property1
.
I want to unset property1. I've tried $row->attributes()->__unset("property1")
and unset($row->attributes()->property1)
. No joy.
Anyone know how to do this?开发者_开发知识库
It's unclear from the question whether you have used this approach, if you have, I'll remove this answer.
Take a look at __unset, simple example is:
class Foo
{
public function __unset($property)
{
unset($this->__my_property_holder[$property]);
}
}
You simply need to do unset($row->attributes()->property1)
, and it will actually invoke Foo->__unset('property1')
.
精彩评论