Hi amitava,

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

yes, but ALL tables have to have an auto incrementing field as well,
so you need:

id
foreign_key
foreign_key

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

I'm really struggling to follow your code in gmail, could you post
your models, controller and view to
http://bin.cakephp.org/add/eleven10 - might help to get you DB as
well.

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

sorry, I didn't mean alphabetical order - I mean this. You have to
make the sure the order of your foreign keys matches the order of
association declarations in your model classes.

Also, it's much easier to stick to the conventions...

cheers,

jon


-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to