A voting system:
Model Ballot: hasMany Options,Votes
Model Option: belongsTo Ballot
Model Vote: belongsTo Ballot
Model User: hasMany Votes
^^Im sort of new to MVC, hopefully those associations are OK!
Now: some controller code for viewing a ballot:
I tried:
$this->Ballot->id = $someID
$this->Ballot->Options->findAll();
I thought that since Ballot is associated with many options:
WHERE `ballot_id` = `Ballot`.`id`
that Options->findAll() would only return an array of Options belonging
to that Ballot, but actually that call is retrieving ALL rows in the
options table
right now, I'm using
$this->Ballot->Options->findAll("ballot_id=$someID");
Am I doing this correctly? Is there any simpler way to get the result I
want?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---