today's offers - xanax use in pregnancy xanax xr be abused soma internet pharmacies fedex soma without priscription fed ex phentermine parkinson drugs phentermine baclofen tramadol together ordering tramadol cod viagra find search 76k cialis pages cialis buy on line viagra for sale without a prescription buy onlinecom phentermine viagra ambien and klonopin drug interaction buy ambien overnight cheap online pharmacies valium saturday delivery valium online with no prescription or membership fioricet overnight no rx cheap fioricet without a prescription order meridia cod fedex meridia cheap fed ex delivery xanax bradycardia what does xanax look like american soma how to buy soma online without prescriptin phentermine overnight echeck c o d 375 mg phentermine rss feed cheap no prescription tramadol stop the tramadol generic prices online cialis generic cialis fedex chinese herbal viagra taking partial pill of viagra ambien and pregnancy smoking ambien cod online valium buy cheap valium without prescription no prescription fioricet with fedex fioricet without prescription in Brasilia order meridia meridia information

Yii 1.1 CActiveRecord 關連的部份修正


剛剛用Yii 的AR 寫的很開心,
下了這個

    $criteria=new CDbCriteria;
    $criteria->condition='products.id=:ID AND products_info.language_id=:languageID';
    $criteria->params=array(':ID'=>$_GET['id'], ':languageID' => $this->_lang_id );
    $criteria->order = 'products_content.content_orders ASC';

    $model = Products::model()->with( 'products_info', 'products_content' )->find( $criteria );

一直出現
CDbCommand 無法執行 SQL 陳述: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘products.id’ in ‘where clause’
想說怪了…
再看了一下 sql log

                  543 Query     SELECT `t`.`id` AS `t0_c0`, `products_info`.`products_id` AS `t1_c0`, `products_info`.`language_id` AS `t1_c1`, `products_info`.`name` AS `t1_c2`, `products_info`.`content` AS `t1_c3`, `products_content`.`id` AS `t2_c0`, `products_content`.`products_id` AS `t2_c1`, `products_content`.`language_id` AS `t2_c2`, `products_content`.`content_name` AS `t2_c3`, `products_content`.`content_value` AS `t2_c4`, `products_content`.`content_orders` AS `t2_c5` FROM `products` `t`  LEFT OUTER JOIN `products_info` `products_info` ON (`products_info`.`products_id`=`t`.`id`) LEFT OUTER JOIN `products_content` `products_content` ON (`products_content`.`products_id`=`t`.`id`) WHERE (products.id='1' AND products_info.language_id='1') ORDER BY products_content.content_orders ASC

發現Products model 變成t 了
想說很怪
再去看了一下 1.1 CHANGELOG
發現了這段..
The alias name for the primary table in a relational AR query is changed to be ‘t’ (Qiang)

好吧乖乖的把products.id改成t.id

  1. No comments yet.
(will not be published)

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word