Hi Jon,
> Nope, your can not use composite keys with cakephp, you have to have
> an ID (or a field that you use as the primary, auto-incrementing id) -
> search the group for more background on this.
I was under the impression that habtm join tables don't need to have a
separate 'id' PK if you're not going to have a Model for it ... the
manual also states that "The contents of the table should be at least
two fields, each foreign keys (which should be integers) pointing to
both of the primary keys of the involved models."
Anyway, as I said earlier, I also used a modified table with an id
field ... in this case find() generates the SQL query "SELECT
`BidSessionRegistration`.`id` FROM `bid_session_registrations` AS
`BidSessionRegistration` WHERE 1 = 1", but shouldn't the code be
querying for user_id and bid_session_id?
What _does_ help is explicitly passing the query fields, like so:
$this->User->BidSessionRegistration->find('list', array('fields' =>
array('bid_session_id','user_id'))) ... but why shouldn't $this->User-
>BidSessionRegistration->find('list') work? That is more intuitive ...
and that is why I wonder where I am making a mistake!
> make sure you define your associations in alphabetical order,
> scaffolding can be quite picky about that (least it was last time I
> used it, though that was some time ago!).
I am not sure I get your point ... are you talking about the order of
defining models in the bake script? (I defined them in the order
BidSession, User, Bid) ... or should I be looking in the respective
model classes? I know I am breaking the naming convention for the
habtm join table, but in this case the name 'registrations' sounds
better ... and I have mentioned the joinTable in both the User and
BidSession models ...
Thanks for your help!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---