<div id="site_container">
<div id="add_cat"><?php echo CHtml::link('Создать сайт',array('site/create')) ?></div>
<?php
$dataProvider=new CActiveDataProvider('Site', array(
'criteria'=>array(
'join'=>'LEFT JOIN theme ON theme.id = site.theme_id INNER JOIN hosting ON hosting.id = site.hosting_id',
'select'=>'site.name, theme.name as theme, site.domain, hosting.expiration, site.c_page, site.c_all_page',
),
));
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider
));
?>
</div>
Error: CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘site.theme_id’ in ‘on clause’
SQL :
SELECT site.name, theme.name as theme, site.domain, hosting.expiration, site.c_page, site.c_all_page
FROM site
LEFT JOIN theme ON theme.id = site.theme_id
INNER JOIN hosting ON hosting.id = site.hosting_id
Please help cusmize criteria setting for this sql
Site.php - Model
<?php
/**
* Description of Site
*
* @author like2dev
*/
class Site extends CActiveRecord {
public static function model($className = __CLASS__) {
return parent::model($className);
}
public function tableName() {
return 'site';
}
public function attributeLabels() {
return array(
'id'=>'Номер',
''=>'',
''=>'',
''=>'',
''=>'',
);
}
}
ER Diagramm^