[wp-trac] [WordPress Trac] #21309: Introduce WP_Post class

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 25 22:11:10 UTC 2012


#21309: Introduce WP_Post class
----------------------------+------------------
 Reporter:  scribu          |       Owner:
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  3.5
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------
Changes (by mikeschinkel):

 * cc: mikeschinkel@… (added)


Comment:

 Replying to [comment:2 scribu]:
 > [attachment:21309.diff] is basically a refresh of
 [attachment:ticket:16574:16574.8.diff]:
 >
 > * merge _get_post_ancestors() into get_post_ancestors()
 > * use get_posts() in get_post_ancestors()
 > * introduce WP_Post class with magic method that calls
 get_post_ancestors()

 I really like what you've done with this patch.

 Can I suggest changing `$post` to `'protected'` so a subclass can access
 it, and add `@property` PHPDoc comments so that we can get auto-complete
 in editors like PhpStorm ''(and so it won't flag those properties as
 errors?):''


 {{{
 /**
  * Wrapper class to preserve back-compat for $post->ancestors
  *
  * @since 3.5.0
  *
  * @property $ID;
  * @property $post_author;
  * @property $post_date;
  * @property $post_date_gmt;
  * @property $post_content;
  * @property $post_title;
  * @property $post_excerpt;
  * @property $post_status;
  * @property $comment_status;
  * @property $ping_status;
  * @property $post_password;
  * @property $post_name;
  * @property $to_ping;
  * @property $pinged;
  * @property $post_modified;
  * @property $post_modified_gmt;
  * @property $post_content_filtered;
  * @property $post_parent;
  * @property $guid;
  * @property $menu_order;
  * @property $post_type;
  * @property $post_mime_type;
  * @property $comment_count;
  * @property $filter;
  *
  */
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21309#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list