And how did the SQL statement look like? It should be displayed just after the error message!
A comment on your database design - if your database is not a legacy database (somebody else designed it) then it would be better to conform to CakePHP conventions for the names of the primary keys and the foreign keys. It will save you a lot of trouble in the future. Enjoy, John On May 11, 1:26 pm, Ambika Kulkarni <[email protected]> wrote: > Hi all, > I am using Store and StoreType models > class Store extends AppModel { > var $name = 'Store'; > var $primaryKey = 'store_id'; > var $belongsTo = array( > 'Division' => array( > 'className' => 'Division', > 'foreignKey' => 'division_id', > 'conditions' => '', > 'fields' => 'division_id, name', > 'order' => ''), > 'StoreType' => array( > 'className' => 'StoreType', > 'foreignKey' => 'store_type_id', > 'conditions' => '', > 'fields' => 'store_type_id, name', > 'order' => '') );} > > class StoreType extends AppModel { > var $name = 'StoreType'; > var $primaryKey = 'store_type_id'; > var $hasMany = array( > 'Store' => array( > 'className' => 'Store', > 'foreignKey' => 'store_type_id', > 'conditions' => '', > 'fields' => '', > 'order' => '')); > > } > > in the controller I put this code > $this->Store->recursive = 0; > > $store = $this->Store->find('all', > array( > 'conditions' => > $condition)); > > $this->set('store',$store); > > I am getting this error > > SQL Error: 1054: Unknown column 'StoreType.id' in 'on clause' [CORE/ > cake/libs/model/datasources/dbo_source.php, line 525] > > Thanks in advance > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 > athttp://groups.google.com/group/cake-php?hl=en 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
