CDbException

CDbCommand не удалось исполнить SQL-запрос: SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row. The SQL statement executed was: SELECT * FROM `cms_catalog` `t` WHERE (t.sections_id=:sections_id AND t.lang=:lang AND published=:published) || (t.id=(SELECT `item_id` FROM cms_catalog_sections WHERE item_id=t.id AND sections_id=:sections_id) AND published=:published) ORDER BY (SELECT rating FROM cms_rating WHERE widget_id="reting_catalog" AND object_id=t.id) DESC, (SELECT votes FROM cms_rating WHERE widget_id="reting_catalog" AND object_id=t.id) DESC LIMIT 30

E:\Rooms\u190398\begiponebu.ru\www\framework\yiilite.php(9341)

9329             return $result;
9330         }
9331         catch(Exception $e)
9332         {
9333             if($this->_connection->enableProfiling)
9334                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
9335             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
9336             $message=$e->getMessage();
9337             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
9338                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
9339             if(YII_DEBUG)
9340                 $message.='. The SQL statement executed was: '.$this->getText().$par;
9341             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
9342                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
9343         }
9344     }
9345     public function buildQuery($query)
9346     {
9347         $sql=!empty($query['distinct']) ? 'SELECT DISTINCT' : 'SELECT';
9348         $sql.=' '.(!empty($query['select']) ? $query['select'] : '*');
9349         if(!empty($query['from']))
9350             $sql.="\nFROM ".$query['from'];
9351         else
9352             throw new CDbException(Yii::t('yii','The DB query must contain the "from" portion.'));
9353         if(!empty($query['join']))

Stack Trace

#3
+
 E:\Rooms\u190398\begiponebu.ru\www\protected\modules\catalog\controllers\DefaultController.php(279): CActiveRecord->findAll(CDbCriteria)
274 
275             $pages           = new CPagination(Catalog::model()->count($criteria));
276             $pages->pageSize = $this->module->pageSize;
277             $pages->applyLimit($criteria);
278 
279             $models = Catalog::model()->findAll($criteria);
280 
281             //Получить стат страницу для раздела каталога
282             Yii::import('application.modules.page.models.*');
283             $modelPage = Pages::model()->find('sections_id=:sections_id', array(':sections_id' => $this->sections->id));
284 
#13
+
 E:\Rooms\u190398\begiponebu.ru\www\index.php(20): CApplication->run()
15 defined('YII_DEBUG') or define('YII_DEBUG',true);
16 // specify how many levels of call stack should be shown in each log message
17 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
18 
19 require_once($yii);
20 Yii::createWebApplication($config)->run();
2024-03-28 14:50:45 Microsoft-IIS/10.0 Yii Framework/1.1.14