Monday, March 5, 2012

Re: (un)conventional associations

$belongsTo = array('Upload' => array('foreignKey' => 'foreign_key', 'conditions' => array('Upload.model' => 'photo')))

On Monday, March 5, 2012 12:12:10 PM UTC-4:30, muka wrote:
Hi,
I've made a nice mess with some tables..

I got a uploads table with two fields (model, foreign_key) which serve
many models, so "Upload.model = 'photo' AND Upload.foreign_key =
Photo.id" give me all the uploads Photo "out of the box".

I can't figure out how to define the back association from Photo model
(hasOne), I got no more foreignKey!

Should I alter the query in the model callback ?

Thanks in advance.
Luca


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: