shulinqian
关键是这个时候就会报错 Property log.botName is not defined 。
亲,这个搞不定哦~~
这样做貌似也可以,不过在视图层写这些貌似很悲剧。。。无处不在,添加一个搜索引擎就要修改n多视图文件。
- shulinqian 回复了话题 求助!
哦,那个sql只是个列子。问题解决了哈,在新手版块,不好意思 发了多个求助。
- shulinqian 发布了话题yii 分页的问题
- shulinqian 回复了话题 求助。
结贴:
终于找到办法了。详细见 http://blog.52xiaoqu.com/31.html
顺着findAll一路追查下去findAll->query->populateRecords->populateRecord
原来是这里做了限制
文件:framework\db\ar\CActiveRecord.php line:1791public function populateRecord($attributes,$callAfterFind=true) { if($attributes!==false) { $record=$this->instantiate($attributes); $record->setScenario('update'); $record->init(); $md=$record->getMetaData(); foreach($attributes as $name=>$value) { $record->$name=$value; if(property_exists($record,$name)) /*这里做了限制*/ $record->$name=$value; else if(isset($md->columns[$name])) $record->_attributes[$name]=$value; } $record->_pk=$record->getPrimaryKey(); $record->attachBehaviors($record->behaviors()); if($callAfterFind) $record->afterFind(); return $record; } else return null; }
知道了是什么限制就好,property_exists是吧?我给模型加上个 var $nums; 运行一下,ok了。真是变态啊!
- shulinqian 发布了话题求助!
- shulinqian 发布了话题求助!
- shulinqian 回复了话题 求助。
我就只想知道
SELECT *,COUNT(*) AS nums FROM test GROUP BY `cid`;
这样的语句怎么处理,都没有人知道吗?