Skip to content
Advertisement

Tag: yii2

Correct way to access Yii2 components in your modules?

I have created and configured a module fooModule. I need to create a component inside the module. This is my configuration for my module in main.php In the folder module fooModule i have created a folder components with a file testComponent.php TestComponet.php has a class test which extend yiibaseComponent. See below How do i access test class in fooModule Controller

Yii2 : how to cache active data provider?

In my PostSearch model I have this code : my try, instead of above line return $dataProvider, would be this block of code: I would like to cache the result returned by ADP, based on the updated_at field. I mean I want to serve data from cache until some change is made. My code does not work, I mean caching

Get the name of the user in yii2

How can I get the name of the logged-in-user in yii2? I can get the user-id with Yii::$app->user->id; and I know that I could find the name in the database but I want a direct way. The name-…

Advertisement