Closed Aleksej-Shherbak closed 4 years ago
Ok. The answer is simple. If you are developing new one application with the help of copy and paste from another one (like me), don't forget to update common/config/bootstrap.php
and add new one alias. My new application's name is api
. It means my bootstrap.php
is:
<?php
Yii::setAlias('@common', dirname(__DIR__));
Yii::setAlias('@frontend', dirname(dirname(__DIR__)) . '/frontend');
Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend');
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/api');
P.S. I use advanced template. Thank you for reading)
I'm trying to follow along this official guide
I have
User
andUserController
. Please, take a look on my code:and User model:
My configuration (config/main.php)
How I start it? Simple. Just with the help of
$ php -S localhost:8900
inside theweb
directory. But when I visitlocalhost:8900/users
I see the following:I have tried to start it via docker: Here is my docker-compose:
and Docker file:
I run it via
docker-compose up -d
. And when I visitlocalhost:22080/users
I see the same like with running via embedded php dev server.So, where I wrong? Where is the problem?
Update
Ok, after some research I have found, that the crash is happening here :
the
!class_exists($className)
takes this string as argument"api\controllers\CategoryController"
and returnstrue
. The condition works, and I havenull
as result.What is happening then? The following:
I see the familiar exception
InvalidRouteException
. Any ideas?