Yii2. Class does not exist



  • The app is advanced.

    I have a unit in common. common\modules\setting\Module

    We need a component. Inside the module, I make a folder of "components." common\modules\setting\componentsIn this file, a file with the name SettingComponent.php Contained file:

    namespace common\modules\setting\components;
    

    use yii\base\Component;

    class SettingComponent extends Component
    {
    // some code...
    }

    common\config\main.php I will connect the component as follows:

    [
    'components' => [
    'setting' => [
    'class' => 'common\modules\setting\components\SettingComponent',
    ],
    // ...
    ],
    ];

    I finally get a mistake:

    ReflectionException
    Class common\modules\setting\components\SettingComponent does not exist

    Here's the sin of the hierarchy, just in case:

    введите сюда описание изображения

    What am I doing wrong?



  • In the files, you wrote it right, but the director called it? :

    введите сюда описание изображения




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2