ok, I think I figured it out by reading >50 older postings with the
keyword "belongsto",
here is the solution:

I was not aware that the NAME for the association can be just ANYTHING
without any reference to the database fields or tables. So by just
using two different names it worked:

var $belongsTo = array ('Publisher1' => array
('className'=>'Publisher','foreignKey'=>'publisher_id'),'Publisher2'
=> array
('className'=>'Publisher','foreignKey'=>'co_publisher_id').......

thanks to jon bennett from this thread:
http://groups.google.com/group/cake-php/browse_thread/thread/7e9e17a5a070e4ef/5a8a18604c669bc1?lnk=gst&q=belongsto#5a8a18604c669bc1

cheers,
karl.

On 10 Jun., 20:20, audioworld <[email protected]> wrote:
> hi and thanks for reading this.
>
> for a literature database I have a database table "resources" with a
> field "publisher" and a field "co-publisher". both should point to the
> same table "publishers" which is a pool of names of persons and
> companies. they can either be publisher or co-publisher, but should
> not exist in the "pool" twice.
>
> so far I was not able to create a valid cake model to have two
> different fields in the same table point to the id of another table, i
> tried various syntaxes, e.g.:
>
> var $belongsTo = array ('Publisher' => array ('foreignKey' => array
> ('co_publisher_id','publisher_id')).......
>
> var $belongsTo = array ('Publisher' => 'foreignKey' =>
> ('co_publisher_id', publisher_id')......
>
> var $belongsTo = array ('Publisher' => array ('foreignKey' =>
> 'co_publisher_id'), 'Publisher' => array ('foreignKey' =>
> 'publisher_id').....
>
> is this not possible or I am just too stupid to figure it out?
> thanks and greetings,
> karl.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to