Orm
Orm is short for Object
Relational Mapper which does 2 things: it maps your database table rows to objects and it allows you
to esteblish relations between those objects.
It follows closely the
Active Record Pattern, but was also influenced by other systems.
Relations: Many to Many
To be written.
Full config example with defaults as values
// in a Model_Post which has and belongs to many Users
// = multiple posts per user and multiple users (authors) per post
$_many_many = array(
'users' => array(
'key_from' => 'id',
'key_through_from' => 'post_id', // column 1 from the table in between, should match a posts.id
'table_through' => 'posts_users', // both models plural without prefix in alphabetical order
'key_through_to' => 'user_id', // column 2 from the table in between, should match a users.id
'model_to' => 'Model_User',
'key_to' => 'id',
'cascade_save' => true,
'cascade_delete' => false,
)
);