this works fine for Photo->Upload but my problem actually is to link back to the Photo model: Upload hasOne Photo
//Upload.php
'Photo' => array(
'className' => 'Photo',
'foreignKey' => ' ? ', // would be what ?
'conditions' => '',
'fields' => '',
'order' => ''
),
Luca
Il 05/03/2012 21:41, José Lorenzo ha scritto:
$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:
Post a Comment