$data = Model_Products::find('all',array(
'related'=>array(
'sizeinproduction'=>array(
'related'=>array(
'size'=>array(
'where'=>array(
'sizename'=>'M'
)
)
)
)
)
));
protected static $_many_many = array(
'size' => array(
'key_from' => 'whatsizes',
'key_through_from' => 'sizeid', // column 1 from the table in between, should match a posts.id
'table_through' => 'size', // both models plural without prefix in alphabetical order
'key_through_to' => 'sizeid', // column 2 from the table in between, should match a users.id
'model_to' => 'Model_Size',
'key_to' => 'sizeid',
'cascade_save' => true,
'cascade_delete' => false,
)
);
BUT! I don't understand why it works.
Will be very very helpful if someone can write article in docs how use ORM with examples. Jelmer Schreuder wrote on Friday 2nd of September 2011:
It looks like you're new here. If you want to get involved, click one of these buttons!