Re: print_r unaware of object's read_property handler
| From: | Piotr Pokora | Date: | Fri, 16 Feb 2007 10:21:04 +0000 |
| Subject: | Re: print_r unaware of object's read_property handler | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4551@lists.php.net to get a copy of this message | ||
mike@php.net (Michael Wallner) wrote:
> He probably means something else, because often it is very hard to grasp
> what you are trying to explain and what your question actually is.
Yes, I can imagine :)
1. In GObject framework you define own get(read)_property hook which is later available
as g_object_get_property. Whoever, wherever invokes this.
2. In Apache framework you define hooks which are invoked wherever by whoever.
No exceptions in both cases.
3. In ZE framework you define own read_property , but there are use cases ( as you already
explained ) where hook is ignored.
So now , I know that my implementation should always keep object properties hash updated.
It doesn't matter if I use those values or not. If I want to benefit from all ZE features I
have to
keep it up to date. That's my bussines how. No more discussion about this.
So now I only need to know what's the preffered way to "register" class or object
properties, that way
so derived classes will inherit properties. So I need to know if get_properties hook is also
inherited by
derived classes or not. And I need to update hash table in get_properties only once. If
get_properties
is the way to go.
Pseudo code:
get_properties_hook ()
{
if(already_updated) {
return obj.properties
} else {
do update
return updated_hash
}
}
If such implemetation allows to use it for base and derived classes I am fine and we can close this
thread.
I would also appreciate a hint if such implementation works if user extends base class with own
defined
properties.
Piotras