ActiveRecord with automatic added Where Statement


I have a problem with RBAC adding additional “where” statement in my ActiveRecord query. How do I remove the Where Statement that contain the " Role = ‘admin’ "


  1. In my Model I do no have any override for the find()

  2. I am using detkrium RBAC.

  3. I do not have role column in the table (myrules) as the results is applicable to every user.

Database Exception – yii\db\Exception

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘role’ in ‘where clause’

The SQL being executed was: SELECT * FROM myrules WHERE role NOT LIKE "admin" ORDER BY seq_no LIMIT 20

Error Info: Array


[0] => 42S22

[1] => 1054

[2] => Unknown column 'role' in 'where clause'

namespace app\models;

use Yii;

class MyRulesModel extends \yii\db\ActiveRecord



 * @inheritdoc


public static function tableName()


    return 'myrules';




use app\models\MyRulesModel;

use yii\data\Pagination;

use yii\db\ActiveRecord;

use yii\data\ActiveDataProvider;

use yii\helpers\ArrayHelper;

use yii\base\Model;

class Controller MyruleController extends \yii\web\Controller

public function actionMyrules()


$model = new MyRulesModel;

$query = MyRulesModel::find()->orderBy("seq_no ASC");

$dataprovider = new ActiveDataProvider([‘query’=> $query ,

'pagination'=> ['pagesize'=>20]]);

echo $this->render(’/network/myrules’,[‘my_model’=>$dataprovider]);



Just to update here. I have found the source of the problem. Someone has modified the Yii /app/data/ActiveDataProvider.php file.