$this->variable in class extends \yii\base\Module

Hi

When I try use $this->any_variable in my new modul for Yii2 (extends \yii\base\Module), recive error :


Getting unknown property: yii\web\View::sortOption

When I use variable static (self::$any_variable) everythink is ok.

I would add that this is not controller return data to view, but only helper class.

Please explain/help

Tnx

You are using $this in a context where it is a \yii\web\View instance.

Post code where you write that.

view/index:


<ul id="ul0" class="nav navbar-nav">

			

<?php foreach (Menu::Left() as $k => $v){

  echo array_key_exists('url', $v) ? Menu::Link($v) : Menu::DropMenu($v);

}

?>

</ul>

class in module




class Menu extends \yii\base\Module

{


public function Left(){


	$m = Menus::find()->where("gr != 1")->orderBy(self::$sortOption)->all();

	return self::toArray($m, self::NAV_ID_LEFT);

}




private function toArray($model, $nav){

	

	//work like statik but not $this->toArray();

}



ps. when i change view


<?php 


$m = new Menu([]);

foreach ($m->Left() as $k => $v){

echo array_key_exists('url', $v) ? Menu::Link($v) : Menu::DropMenu($v);

				}

?>

working well. To many static method ?