Morning all,
How's the weekend?
I'm just starting to play around with the bindModel and unbindModel
functions and I've got to say I'm pretty happy with them. However, one
small issue arises when I try to include conditions in my association.
I've tested a little bit and the fact I'm creating the association on
the fly makes no difference. Setting the condition in the $hasMany
association array of the model creates the same problem.
For example, a Model ConfigOption which has many ConfigChoices I bind
with the following:
/* has many */
var $hasMany = array(
'ConfigChoice' => array(
'className' => 'ConfigChoice',
'dependent' => false,
'foreignKey' => 'config_option_id',
'order' => 'ConfigChoice.sequence ASC',
'conditions' => array(
'ConfigChoice.selected' => 'Y'
)
)
);
For some reason, the SQL statement created withOUT the condition has a
WHERE clause:
WHERE `ConfigChoice`.`config_option_id` = '1'
The WHERE clause when the condition is included:
WHERE (`ConfigChoice`.`selected` = 'Y') AND
(`ConfigChoice`.`config_option_id` = ''1'')
Very odd. Am I doing something wrong here in setting up my associations?
Thanks for your help on this one.
Freedom
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---