On Aug 17, 2007, at 1:23 PM, Ray Hunter wrote:

Do you see anyway around this? My parent class is a generic database
table wrapper to provide ORM mapping. Each child class maps to a
specific table. I'd like to implement several static functions such as search_by(), a factory pattern that returns an object or objects of its
own class that match the search. I see no way to define the database
table in a child class and have it passed back to a static function in
the parent class.

you might want to override the parent classes implementation. or create
an abstract method in parent that gets overriden in the child.


Ray, I'm not sure I understand.

By the way, it appears this issue is well documented in the comments of the get_class() function. For example, another impossibility raised by this bug is extending a Singleton class:

http://us.php.net/manual/en/function.get-class.php#usernotes

This comment seemed to summarize it well:
"Basically these design patterns, and various other meta manipulations (things which operate on the nature of the object, not on the data the object holds) could benefit greatly from knowing exactly what the final type of this object is, and not having native access to this information obligates work-arounds."
Richard



_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to