Yet another post object wrapping 01

A Backbone inspired WordPress post proxy class.

Which problem should it solve?

WordPress extends the limited amount of information that can be stored in the posts database columns using the postmeta and terms tables plus some accessory others.
This has allowed the core object handled and managed by WordPress, the post, to outlive its limitations and make WordPress the platform it is today.
While developing plugins or client sites I often find myself wrapping the functions to handle a post data, meta values and taxonomy terms over and over.
In usage terms the I try to go, with that wrapping, from a technology oriented approach to a domain oriented one.
An example

$car = get_post(23); // a post of the 'car' post type

$name = $car->post_title;

$color = get_post_meta(23,'color',true);

$brand = reset(wp_get_object_terms(23, 'car_brand','fields'=>'names'));

In information terms a car name, color and brand are coherent: they help define and describe the car. In technology terms (or “implementation”) those are not due to the way WordPress stores data.
Should I start with a fresh database table for this project it would have the name, color and brand columns for a start.

Not a problem

The example above did not stop WordPress from becoming the mainstream platform it is today so the word “problem” means “the meh sensation the above example provokes to me and that’s probably just me”.

A solution (to something that’s not a problem)

Since I’ve written the same wrapping code too many times I’ve made the leap to write a plugin to have that ready to use in any project: tad-post.
It’s a draft version so not ready for production.
It’s meant to be a base that, after little extension and personalization, will allow the example above to be written like

$car = Acme\Car_Repository::create(23);

$name = $car->name;
$pith = $car->pitch;
$color = $car->color;
$brand = $car->brand;

this will be possible extending the base class defined in the plugin like this

class Acme\Car extends tad_Post{

    public function get_column_aliases(){
        return array(
            'name' => 'post_title',
            'description' => 'post_content',
            'pitch' => 'post_excerpt',
            'availability' => 'post_status'
        );
    }   

    public function get_single_meta_keys() {
        return array('color');
    }

    public function get_single_term_keys() {
        return array('brand');
    }

}

and the corresponding Car_Repository

class Car_Repository extends tad_AbstractPostRepository{

    public static function get_post_type() {
        return 'car';
    }

    public static function get_post_class() {
        return 'Acme\Car';
    }   

}

Next

I’ve not tested the class and will do to make sure it works as intended and to my taste.