novius-os/core — pull request #85 by vrcAlbert (2014-02-19 16:19:57+00:00)
Title: Add a new behaviour to implement a fake relation with data on it

an abstract model is provided to construct the fake relation

A way to use it should be like this (for an orderered relation) :

Class :
```php
array(
'key_from' => 'prod__id',
'model_to' => 'Catalogue\Model_Product',
'key_to' => 'prod_id',
'cascade_save' => false,
'cascade_delete' => false,
)
);

protected static $_belongs_to = array(
'gamme' => array(
'key_from' => 'gamm__id',
'model_to' => 'Catalogue\Model_Gamme',
'key_to' => 'gamm_id',
'cascade_save' => false,
'cascade_delete' => false,
),
);
}
```
Model with the behaviour :
```php
protected static $_has_many = array(
'products' => array(
'key_from' => 'gamm_id',
'model_to' => 'Catalogue\Model_OrderMany',
'key_to' => 'gamm__id',
'cascade_save' => true,
'cascade_delete' => false,
'conditions' => array(
'order_by' => array('prod_order')
)
),
);

protected static $_behaviours = array(
'Nos\Orm_Behaviour_DataMany' => array(
'events' => array('before_save', 'after_save', 'after_delete', 'before_delete'),
'relation' => 'products',
),
);
```