V
V
Vladimir2018-04-08 13:05:46
Yii
Vladimir, 2018-04-08 13:05:46

Why is there a "Class not found" error in Yii2?

Good day! I made a module in one Yii2 project, I needed it in the second one, I just copied it to this project, but when I try to open it, I get the error "Class 'backend\modules\media_library\models\MediaLibrary' not found".
In the model that lies along the path "backend/modules/media_library/models" it says "namespace backend\modules\media_library\models;"
The controller says "use backend\modules\media_library\models\MediaLibrary;"
Tell me what could be the problem? If you need any more information, please write in the comments.
Thanks in advance for the replies!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shooters, 2018-04-11
@sni10

PSR-4 Learn the
materiel - https://github.com/codedokode/pasta/blob/master/ph...
PS Have you registered the namespace of the module in the config?

$config = [
    // ...
  'modules' => [
    'admin' => [
                         'class' => 'app\modules\admin\Module',
                ],
  ],
    // ...
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question