Samstag, 25. Juli 2015

Yii2: Access your services within your module

There're some ways to declare the service in your config file for global use, but I wanted a way to setup my service in my module. Well, it took me a while so I write the way down here to look back in future to not search around the web.

Firstly you need to declare the service in your module:
Afterwards you can access your module wherever you want to (note the cast for handier usage in your IDE):

Keine Kommentare:

Kommentar veröffentlichen