I'm still quite new at CakePHP so it may be why I didn't get that.
Here is my problem:
I've got three Models: books, writers, publishers. All have only id
and name fields, to make it simple.
1. Correct me if I'm wrong, but relationships should be as follow:
Book belongsTo Writer
Book belongsTo Publisher
Writer hasMany Book
Publisher hasMany Book
2. I'm really happy with what Bake cooked for me. Except in one case.
When I'm using the view action of the Writer controller, at the bottom
there is a very convenient table, showing related Books. But this
tables doesn't show the Publisher 'name' but its 'id'. I'd like to see
the 'name' here instead of the id.
That is, I'd like CakePHP to make a JOIN query in the "Related" area
of the writer/view action.
3. Here is what I've tried
- modifying the relationships between the models.
- playing with the $recursive parameter of the model.
- playing with the fields parameter of the belongsTo relationship or
the hasMany relationship.
None of these above worked. Would you be compassionate enough to help
me find a solution? This way, I'd definitively get better at
baking..!
Thanks a lot,
Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment