Sunday, July 29, 2012

Re: Linking Models Together

it always search for primary key, set $primaryKey variable in model to your column
--
Lep pozdrav, Tilen Majerle



2012/7/29 newt_e <newt_e@blueyonder.co.uk>
Hi,

I've have two tables:
authors, has a column called id (amongst others)
books, has columns called id and authorid  (amongst others)

Obviously a book has an author, so any value of authorid must exist in the authors table.

When I retrieve an authors row, I also want to return the corresponding authors row (books.authorid = authors.id). 

However, when trying to update my Book model, it always seems to link from the id column - how do I make it work against a different column?

Cheers,
N.

--
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

--
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: