I've one module -> users.
->modules
->users
->controllers
->models
->views
->Users.php
I created one 'config.php' inside 'config' folder of 'users' modules.
->modules
->users
->config
->config.php
->controllers
-> List of Controllers
->models
-> List of models
->views
-> List of Views
->Users.php
And, i gave directory path of config.php in init() method of Users.php, as
modules/users/Users.php
<?php
namespace app\modules\users;
class Users extends \yii\base\Module
{
public $controllerNamespace = 'app\modules\users\controllers';
public $commonModel = 'app\modules\users\models\Users';
public function init()
{
parent::init();
\Yii::configure($this,require(__DIR__.'/config/config.php'));
}
}
But, it is giving error like
PHP Warning – yii\base\ErrorException
"Invalid argument supplied for foreach()".
Screenshot
I am taking reference from Yii2.0 Guide to include a path inside init() method.
Please help me to rectify this issue.
Thanks.