I have three models: Shift, Sale and Log that are related using
CakePHP associations (see model definitions below). I want to find
logs and return their associated sale and the sale's associated shift.
But I'm having a hard time with this...

$this->find('all', array(
        'contain' => array(
                'Department',
                'Sale',
                'Sale' => array('Shift')
        ),
        'fields' => array('Shift.closed', 'Log.cost'),
));

Any idea why this produces "SQL Error: 1054: Unknown column
'Shift.closed' in 'field list'? Where am I going wring? Any advice
would be appreciated! I've also tried using recursive instead of
contain, but had similar results.

Models:
class Log extends AppModel {
        var $name = 'Log';
        var $belongsTo = array('Department', 'Sale');
        var $actsAs = array('Containable');
}
...
class Sale extends AppModel {
        var $name = 'Sale';
        var $belongsTo = array('Shift');
        var $hasMany = array('Log');
}
...
class Shift extends AppModel {
        var $name = 'Shift';
        var $hasMany = array('Sale');
}

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