Hi, i want to create construct to assign inital value to my active record class property.
I has read the guide about the construct.
http://www.yiiframework.com/doc-2.0/yii-base-object.html#__construct()-detail
But im still confuse. How to write the construct properly?
public void function __construct($config=[]){ <-- is this parameter needed? it is causing error
$this->myproperty = 'initial value';
parent::__construct('what array to pass here');
}
that void result in this error
syntax error, unexpected ‘void’ (T_STRING), expecting variable (T_VARIABLE)
i got it working like this, but dunno if this is ok
public function __construct(){
$this->myproperty = 'initial value';
parent::__construct();
}