In Advert table ID is primary key. considering this code:
$specialAds = Advert::model()->findAll(array(
'condition'=>'type=:special_ad and expiration_date < NOW()',
'select'=>'type, leaf',
'limit' => 100,
'params'=>array(':special_ad'=>Advert::Special_Ad)
));
var_dump($specialAd->saveAttributes(array('type'=>Advert::Special_Ad,'leaf'=>null)));
In above code don’t save attributes with given values. because ID in select condition is not set.
If select changed as following:
'select'=>'id, type, leaf',
attributes values will save truly. what’s the reason?