yii框架建立mongo model 以及调用的时候问题

来源:互联网 发布:南充哪里有淘宝培训 编辑:程序博客网 时间:2024/05/01 04:42
class CliInfo extends ActiveRecord{    public static function collectionName()    {        return 'cli_info';    }    public function attributes()    {        return [ $attributes]; // 这里是一定要被复写的 而且必须包含 _id    }}
一般的功能是不是需要在model里面封装的   
update   CliInfo::find()->where($where)->modify($update)
query      
     CliInfo::find()    ->select($fileds)    ->one();
之前犯了一个低级的错误  (new CliInfo())::find()  这种调用的方式是不行的 因为 new CliInfo()是对象,对象调用精华太方法必须 -> 
自然不可以使用静态调用的方式
原创粉丝点击