R
R
Ruslan2017-08-12 20:37:35
Yii
Ruslan, 2017-08-12 20:37:35

How to add a part to a yii2 project as a frontend or backend?

Good day. I am developing a project on yii2 advanced, I added the employee folder to the project root and copied the contents of the frontend folder there. registered in config / main:
'controllerNamespace' => 'employee\controllers',
after that it started throwing out:

An Error occurred while handling another error:
exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' in D:\OpenServer\domains\flightAreportSistem.loc\vendor\yiisoft\yii2\base\Module.php:532
Stack trace:
#0 D:\OpenServer\domains\flightAreportSistem.loc\vendor\yiisoft\yii2\web\ErrorHandler.php(97): yii\base\Module->runAction('site/error')
#1 D:\OpenServer\domains\flightAreportSistem.loc\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 "site/index".' in D:\OpenServer\domains\flightAreportSistem.loc\vendor\yiisoft\yii2\base\Module.php:532
Stack trace:
#0 D:\OpenServer\domains\flightAreportSistem.loc\vendor\yiisoft\yii2\web\Application.php(102): yii\base\Module->runAction('site/index', Array)
#1 D:\OpenServer\domains\flightAreportSistem.loc\vendor\yiisoft\yii2\base\Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#2 D:\OpenServer\domains\flightAreportSistem.loc\employee\web\index.php(17): yii\base\Application->run()
#3 {main}

Next exception 'yii\web\NotFoundHttpException' with message 'Page not found.' in D:\OpenServer\domains\flightAreportSistem.loc\vendor\yiisoft\yii2\web\Application.php:114
Stack trace:
#0 D:\OpenServer\domains\flightAreportSistem.loc\vendor\yiisoft\yii2\base\Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#1 D:\OpenServer\domains\flightAreportSistem.loc\employee\web\index.php(17): yii\base\Application->run()
#2 {main}

Also, I can’t add a module to this folder via gii along the path employee \ modules \ profile \ Module, it gives an error that the path does not exist,
please help. ....... I searched the net for how to properly add folders of this kind to the project, but did not find anything, so I'm asking here

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
latteo, 2017-08-12
@Rysl_prog_diz

\common\config\bootstrap.php
add:
it turned out to be enough for me to add a folder to the root of the project

M
Maxim Timofeev, 2017-08-12
@webinar

copied the contents of the frontend folder there

this is not enough, go through the config and check all the settings, there are probably a lot of "tails" from frondend. Also, add an alias as latteo suggested . Well, all namespaces need to be changed. In controllers, in Assets, etc. I advise you to search through the folder and find all the references.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question