Cathay

Cathay

实践大于一切设想。

  • 财富值3500
  • 威望值40
  • 总积分4140

个人信息

  • 2019-08-25 已签到
    连续签到6天,获得了20个金钱
  • 2019-08-26 已签到
    连续签到7天,获得了20个金钱
  • 2019-08-24 已签到
    连续签到5天,获得了20个金钱
  • 2019-08-22 已签到
    连续签到3天,获得了15个金钱
  • 2019-08-23 已签到
    连续签到4天,获得了20个金钱
  • cas单点登录 了解一下

  • 2019-08-21 已签到
    连续签到2天,获得了10个金钱
  • 还有一种写法:

    $query->andWhere(new OrCondition([
        new InCondition('type', 'in', $types),
        ['like', 'name', '%good%'],
        'disabled=false'
    ]));
    

    点击:配合数据库工作,查找关键字:OrCondition

    看了下源码,['OR', 操作数1, 操作数2, ...] 最后转换就是用到就是用到类OrCondition

    相关文件及关键代码:
    文件:Class yii\db\QueryBuilder

    代码:

        /**
         * Contains array of default condition classes. Extend this method, if you want to change
         * default condition classes for the query builder. See [[conditionClasses]] docs for details.
         *
         * @return array
         * @see conditionClasses
         * @since 2.0.14
         */
        protected function defaultConditionClasses()
        {
            return [
                'NOT' => 'yii\db\conditions\NotCondition',
                'AND' => 'yii\db\conditions\AndCondition',
                'OR' => 'yii\db\conditions\OrCondition',
                'BETWEEN' => 'yii\db\conditions\BetweenCondition',
                'NOT BETWEEN' => 'yii\db\conditions\BetweenCondition',
                'IN' => 'yii\db\conditions\InCondition',
                'NOT IN' => 'yii\db\conditions\InCondition',
                'LIKE' => 'yii\db\conditions\LikeCondition',
                'NOT LIKE' => 'yii\db\conditions\LikeCondition',
                'OR LIKE' => 'yii\db\conditions\LikeCondition',
                'OR NOT LIKE' => 'yii\db\conditions\LikeCondition',
                'EXISTS' => 'yii\db\conditions\ExistsCondition',
                'NOT EXISTS' => 'yii\db\conditions\ExistsCondition',
            ];
        }
    
  • 2019-08-20 已签到
    连续签到1天,获得了5个金钱
  • 我觉得可以这样写:

    $query->andFilterWhere([
        'OR', 
        ['id' => $this->location_id], 
        ['area_id' => $this->location_id], 
        ['city_id' => $this->location_id], 
        ['province_id' => $this->location_id]
    ]);
    
总监 等级规则
4140/5000
资料完整度
100/100
用户活跃度
0/100

Ta的关注

4

Ta的粉丝

6

Ta的访客

24