I have a class (yii2 widget) that has private properties and public static functions. When I try to access a private property from the static method like $this->MyPrivateVar
an error is generated regarding that I don't have to use $this
in non object context! The following is a snippet of my code:
class JuiThemeSelectWidget extends Widget
{
private $list;
private $script;
private $juiThemeSelectId = 'AASDD5';
public $label;
....
public static function createSelectList($items)
{
$t = $this->juiThemeSelectId;
...
}
I tried the following, but it seems that undergoes to infinite loop Maximum execution time of 50 seconds exceeded
!
public static function createSelectList($items)
{
$t = new JuiThemeSelectWidget;
$juiThemeSelectId = $t->juiThemeSelectId;
...
}
So how could I access the private juiThemeSelectId
from the static method?