rahmatheruka
rahmatheruka

Reputation: 57

How to add new apps folder in Yii2 advanced

I start install Yii 2 with yii-advanced-app-2.0.11.tgz archive. After unpacking and init, i have run successful Yii 2 advanced. In folder project, i see backend and frontend application. Now, i wanna create clinic application is here. Yii 2 can do it?. I search google, but can't find solution.

and then I copy frontend directories and name it "clinic" then replace all words "frontend" to "clinic". but I get error like this:

An Error occurred while handling another error:
exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' in R:\xampp-1-8\htdocs\berobat.id\vendor\yiisoft\yii2\base\Module.php:532
Stack trace:
#0 R:\xampp-1-8\htdocs\berobat.id\vendor\yiisoft\yii2\web\ErrorHandler.php(95): yii\base\Module->runAction('site/error')
#1 R:\xampp-1-8\htdocs\berobat.id\vendor\yiisoft\yii2\base\ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))
#2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#3 {main}
Previous exception:
exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "".' in R:\xampp-1-8\htdocs\berobat.id\vendor\yiisoft\yii2\base\Module.php:532
Stack trace:
#0 R:\xampp-1-8\htdocs\berobat.id\vendor\yiisoft\yii2\web\Application.php(102): yii\base\Module->runAction('', Array)
#1 R:\xampp-1-8\htdocs\berobat.id\vendor\yiisoft\yii2\base\Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#2 R:\xampp-1-8\htdocs\berobat.id\klinik\web\index.php(17): yii\base\Application->run()
#3 {main}

Next exception 'yii\web\NotFoundHttpException' with message 'Page not found.' in R:\xampp-1-8\htdocs\berobat.id\vendor\yiisoft\yii2\web\Application.php:114
Stack trace:
#0 R:\xampp-1-8\htdocs\berobat.id\vendor\yiisoft\yii2\base\Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#1 R:\xampp-1-8\htdocs\berobat.id\klinik\web\index.php(17): yii\base\Application->run()
#2 {main}

in my perception, this is about setting config namespaceController="clinic/controllers", when I change it to "frontend/controller" this error exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' not showing anymore, but you know, if still in this config, my clinic apps will load frontend controller. So what should I do? Help me please!. Thanks so much!.

Upvotes: 2

Views: 1295

Answers (1)

Irfan Ali
Irfan Ali

Reputation: 2258

Add your clinic alias in common/config/bootstrap.php file like below and update all frontend namespaces in your clinic folder with newly added alias word.

 Yii::setAlias('@clinic', dirname(dirname(__DIR__)).'/clinic');

Upvotes: 2

Related Questions