Doesn’t look like it’s possible, at least there doesn’t seem to be an elegant way. get_row()
invokes query()
, which uses mysql_fetch_object()
with a single parameter, ie it’s not possible to pass anything to its class_name
parameter.
So, the only option left would be to extend the wpdb
class, implement custom code so that it can return custom classes, and then create an instance of the new class in the global $wpdb
variable before WordPress calls require_wp_db()
. But that would be some really ugly hack if you ask me.
Ofcourse you could always create instances of your custom classes manually and populate them from the retreived stdClass
instance, just like WordPress does:
http://core.trac.wordpress.org/browser/trunk/wp-includes/post.php#L605
public function __construct( $post ) {
foreach ( get_object_vars( $post ) as $key => $value )
$this->$key = $value;
}