`Club` and `Music`. When I want to add a new club, I do the following
in the Clubs controller:
$this->set('musics', $this->Club->Music->find('list'));
Like magic my admin_add view for Clubs displays a series of checkboxes
with a list of music from the Music model.
So here's the problem: I have a field in the Musics table called
'inactive'. I'd like to use it to restrict certain entries in the
Musics table from the admin_add view for Clubs. In other words, if we
discontinue certain types of music, I don't want it available to new
Clubs. However, I can't seem to get the above query to accept
conditions. This is what I currently have:
$params = array(
'conditions' => array('Music.inactive' => '0')
);
$this->set('musics', $this->Club->Music->find('list', array
($params)));
However, the full list of items from the Musics table always appears
when I need only the entries with 'inactive' = 0. Here's what the
debugger always shows.
SELECT `Music`.`id`, `Music`.`name` FROM `musics` AS `Music` WHERE 1 =
1
How do I get this?
SELECT `Music`.`id`, `Music`.`name` FROM `musics` AS `Music` WHERE
`Music`.`inactive` = 0
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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