[wp-trac] [WordPress Trac] #12267: Upgrade loop objects to provide identical presentational interfaces.
WordPress Trac
wp-trac at lists.automattic.com
Sat Feb 20 16:41:20 UTC 2010
#12267: Upgrade loop objects to provide identical presentational interfaces.
-------------------------+--------------------------------------------------
Reporter: andy | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: General | Version:
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
Comment(by filosofo):
After a discussion with andy and hakre on IRC, I've reworked some of the
ideas into my patch WP_Object_Factory.12267.diff
WP_Object_Factory has a static method, "create", which creates and returns
WP_Objects.
WP_Object acts like an abstract class (not in reality abstract because we
have to follow PHP 4 syntax), currently has just a few properties, some
getters for those properties, and a property setter. WP_Post and
WP_Comment extend WP_Object.
* I went with "WP_Object" instead of "WP_Presentable" after our
discussion, in which we seemed to agree that for now it would be better to
separate raw property access from presentation. WP_Object is meant to
provide an interface for raw property access; something like
WP_Presentable in the future would perhaps decorate WP_Object objects,
applying the appropriate filters, etc.
* In my opinion it's better form to keep the factory separate from
abstract object parent class:
* The structure is immediately obvious and familiar.
* The create method can be static.
* WP_Object child objects can be instantiated independently.
* WP_Object probably needs some more default properties, such as
author_id.
* WP_Object is backwards compatible with existing raw database-returned
objects, as its particular properties are supposed to be protected
(obviously limited by PHP 4 here).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12267#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list