cake-php@googlegroups.com
[Top] [All Lists]

Custom model association column

Subject: Custom model association column
From: Diogo FC Patrao
Date: Tue, 21 Feb 2012 18:59:22 -0200
Hi all

I have a data model like this:

HospitalAdmission belongsTo Subject hasMany Contents

That is, I have a subject_id column on HospitalAdmission, and a column with the same name in Contents. Plus, HospitalAdmission is in one database, and Subject and Contents in other, not being possible (for technical reasons) to join them together in the same query.

I'd like to directly get all HospitalAdmissions linked to some Content, but I only found documentation on how to specify the foreignKey of a hasMany relation - in this case, I would have to specify hasMany not to look into Content.id field.

I could do this programatically (by getting all subject_id from a Content->find('all') and then HospitalAdmission->find('all')), or putting the full relationship with Subject (which would be a little cumbersome, as I don`t really need any information in this 

any thoughts?

--
diogo patrão



--
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@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/cake-php
<Prev in Thread] Current Thread [Next in Thread>