First, have a look at the output query - if you have the <?php echo
$this->element('sql_dump'); ?> set in your layout, it should be at the
bottom. That should give you some clues as to why it's not working.But you might want to post your $hasMany association to this group so we can help better. Are you actually specifying the foreignKey? That might be the problem. On Jul 29, 10:45 pm, dean <[email protected]> wrote: > Hi all, > > I'm having a slight problem with querying data on an association I've > created. > > The two models are Product and ProductVariation. The ProductVariation > model belongs to the Product model and the Product model hasMany > ProductVariations. > > This is all well and good until I attempt to run the following query: > > $this->Product->find('all', array('conditions' => > array('ProductVariation.id' => 5))); > > I get a notice saying - SQL Error: 1054: Unknown column > 'ProductVariation.id' in 'where clause' > > I don't understand, the models are associated and when I pull out a > single product by its ID, the ProductVariation's are retrieved as > well, but I cannot seem to get a condition bound to that column! > > Any insight would be greatly appreciated. > > Thanks in advance Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
