Yii2 column attribute variable as public

Hello All,

I understand that all column variables of a model are ‘protected’ by default. If I change it to public, the variable value becomes NULL in GridView and ListView. I am trying to do this, because I need to access this public variable in a child’s child class through inheritance.

Below is what I am trying to do;

class A extends  ActiveRecord{

 public static function tableName() {

        return 'abc_table';


// declare this variable as public

public $column_value_1;

public function rules() {

['column_value_1', 'required'],



Do not declare a variable representing a database column manually, or you will break the functionality of Active Record.