php - How in Yii 2 access AR object as component? -


actually, want have access ar object in anywere. want access ojb yii component.

like yii using user: yii::$app->user->identity - user component contains user ar object.

i want store page ar in component. so, it's something: yii::$app->page->page - page ar propery of page component. not nice :(. way?

in config can set it. user set , adapt requirements.

$config = [     ...     'components'=>[         ....         'user' => [             'class'=>'yii\web\user',             'identityclass' => 'common\models\user',             ...         ],         ...     ], ... ]; 

read more in yii2 documentation on link


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -