CDbException

CDbCommand falló al ejecutar la sentencia SQL: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'zone_id' in where clause is ambiguous. The SQL statement executed was: SELECT `t`.`id` AS `t0_c0`, `t`.`title` AS `t0_c1`, `t`.`gift_title` AS `t0_c2`, `t`.`slug` AS `t0_c3`, `t`.`tags` AS `t0_c4`, `t`.`share` AS `t0_c5`, `t`.`description` AS `t0_c6`, `t`.`conditions` AS `t0_c7`, `t`.`price_original` AS `t0_c8`, `t`.`price_promo` AS `t0_c9`, `t`.`porcentaje_comision` AS `t0_c10`, `t`.`monto_comision` AS `t0_c11`, `t`.`forma_pago` AS `t0_c12`, `t`.`porcentaje_primer_pago` AS `t0_c13`, `t`.`priority` AS `t0_c14`, `t`.`date_start` AS `t0_c15`, `t`.`date_end` AS `t0_c16`, `t`.`date_expire` AS `t0_c17`, `t`.`source` AS `t0_c18`, `t`.`state` AS `t0_c19`, `t`.`max_coupon` AS `t0_c20`, `t`.`max_pp` AS `t0_c21`, `t`.`counter` AS `t0_c22`, `t`.`fake_counter` AS `t0_c23`, `t`.`type` AS `t0_c24`, `t`.`presale_start` AS `t0_c25`, `t`.`presale_end` AS `t0_c26`, `t`.`date_create` AS `t0_c27`, `t`.`date_update` AS `t0_c28`, `t`.`zone_id` AS `t0_c29`, `t`.`partner_id` AS `t0_c30`, `t`.`product_id` AS `t0_c31`, `t`.`category_id` AS `t0_c32`, `product`.`id` AS `t1_c0`, `product`.`name` AS `t1_c1`, `product`.`slug` AS `t1_c2`, `category`.`id` AS `t2_c0`, `category`.`name` AS `t2_c1`, `category`.`slug` AS `t2_c2`, `partner`.`id` AS `t3_c0`, `partner`.`name` AS `t3_c1`, `partner`.`username` AS `t3_c2`, `partner`.`password` AS `t3_c3`, `partner`.`email` AS `t3_c4`, `partner`.`weburl` AS `t3_c5`, `partner`.`facebook` AS `t3_c6`, `partner`.`twitter` AS `t3_c7`, `partner`.`instagram` AS `t3_c8`, `partner`.`address` AS `t3_c9`, `partner`.`googlemaps` AS `t3_c10`, `partner`.`mapurl` AS `t3_c11`, `partner`.`latitud` AS `t3_c12`, `partner`.`longitud` AS `t3_c13`, `partner`.`marcas` AS `t3_c14`, `partner`.`phone` AS `t3_c15`, `partner`.`business_name` AS `t3_c16`, `partner`.`rif` AS `t3_c17`, `partner`.`bank` AS `t3_c18`, `partner`.`account_type` AS `t3_c19`, `partner`.`account_number` AS `t3_c20`, `partner`.`phone_exchange` AS `t3_c21`, `partner`.`phone_bill` AS `t3_c22`, `partner`.`address_bill` AS `t3_c23`, `partner`.`address_exchange` AS `t3_c24`, `partner`.`contact_name_promo` AS `t3_c25`, `partner`.`contact_phone_promo` AS `t3_c26`, `partner`.`contact_address_promo` AS `t3_c27`, `partner`.`contact_name_admin` AS `t3_c28`, `partner`.`contact_phone_admin` AS `t3_c29`, `partner`.`contact_address_admin` AS `t3_c30`, `partner`.`contact_name_promo_canje` AS `t3_c31`, `partner`.`contact_phone_promo_canje` AS `t3_c32`, `partner`.`contact_address_promo_canje` AS `t3_c33`, `partner`.`date_create` AS `t3_c34`, `partner`.`date_update` AS `t3_c35`, `partner`.`zone_id` AS `t3_c36`, `partner`.`segment_id` AS `t3_c37`, `partner`.`salesman_id` AS `t3_c38`, `partner`.`profit_id` AS `t3_c39`, `zone`.`id` AS `t4_c0`, `zone`.`name` AS `t4_c1`, `zone`.`slug` AS `t4_c2`, `zone`.`town_id` AS `t4_c3` FROM `promotion` `t` LEFT OUTER JOIN `product` `product` ON (`t`.`product_id`=`product`.`id`) LEFT OUTER JOIN `category` `category` ON (`t`.`category_id`=`category`.`id`) LEFT OUTER JOIN `partner` `partner` ON (`t`.`partner_id`=`partner`.`id`) LEFT OUTER JOIN `zone` `zone` ON (`t`.`zone_id`=`zone`.`id`) WHERE (date_start <= CURDATE() AND date_end > CURDATE() AND state = "activa" AND `zone_id` IN (2, 3, 6, 7, 8, 26, 28, 32, 47, 49, 50, 54, 55, 56, 76, 83, 99, 110, 111, 115, 9, 13, 14, 15, 17, 23, 24, 34, 77, 107, 123, 5, 10, 11, 12, 16, 62, 92, 4, 21, 22, 48, 141, 1, 18, 19, 20, 27, 29, 30, 31, 33, 43, 44, 45, 52, 53, 57, 58, 74, 75, 82, 90, 103, 114, 137, 79, 95, 134, 142, 109) AND product_id = 4) ORDER BY priority DESC, date_start DESC

/var/www/html/yii/yiitd/framework/db/CDbCommand.php(543)

531         {
532             if($this->_connection->enableProfiling)
533                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
534 
535             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
536             $message=$e->getMessage();
537             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
538                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
539 
540             if(YII_DEBUG)
541                 $message.='. The SQL statement executed was: '.$this->getText().$par;
542 
543             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
544                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
545         }
546     }
547 
548     /**
549      * Builds a SQL SELECT statement from the given query specification.
550      * @param array $query the query specification in name-value pairs. The following
551      * query options are supported: {@link select}, {@link distinct}, {@link from},
552      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
553      * {@link limit}, {@link offset} and {@link union}.
554      * @throws CDbException if "from" key is not present in given query parameter
555      * @return string the SQL statement

Stack Trace

#6
+
 /var/www/html/td/ambiente/protected/modules/frontend/controllers/pagina/PromocionesAction.php(252): CActiveRecord->findAll(CDbCriteria)
247             $criteria->compare('date_start'," <= ".$today_date,true);
248             $criteria->compare('date_end'," > ".$today_date,true); */
249             
250             $criteria->condition = 'date_start <= CURDATE() AND date_end > CURDATE() AND state = "activa" AND `zone_id` IN ('.$ids.') AND product_id = '.$model_product->id;
251             $criteria->order = 'priority DESC, date_start DESC';
252             $promociones = Promotion::model()->with('product')->with('category')->with('partner')->with('zone')->findAll($criteria);
253 
254             foreach ($promociones as $key => $value) {
255                 if (empty($value->multimedia)) {
256                     unset($promociones[$key]);
257                 }
#16
+
 /var/www/html/td/ambiente/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2016-05-31 07:25:47 Apache/2.4.7 (Ubuntu) Yii Framework/1.1.16