A
A
Alexander Stepanov2018-03-18 14:06:38
Yii
Alexander Stepanov, 2018-03-18 14:06:38

Where to find the absence of a class?

Caught a mistake

ReflectionException
Class common\bootstrap\SetUp does not exist
/sites/test/html/vendor/yiisoft/yii2/di/Container.php

The common\bootstrap\SetUp file itself is present at the corresponding address, it is registered in the configs...
SetUp code:
namespace common\bootstrap;

use Yii;
use yii\mail\MailerInterface;
use yii\base\BootstrapInterface;
use shop\services\ContactService;
use shop\services\auth\PasswordResetService;

class SetUp implements BootstrapInterface
{
    public function bootstrap($app)
    {
        $container = Yii::$container;

        $container->setSingleton(PasswordResetService::class);

        $container->setSingleton(MailerInterface::class, function () use ($app){
            return $app->mailer;
        });

        $container->setSingleton(ContactService::class, [], [
            $app->params['adminEmail']
        ]);
    }
}

Back config:
'bootstrap' => [
        'log',
        'common\bootstrap\SetUp',
        'backend\bootstrap\SetUp',
    ],

Front config:
'bootstrap' => [
        'log',
        'common\bootstrap\SetUp',
        'frontend\bootstrap\SetUp',
    ],

Common config:
'bootstrap' => [
        'queue',
      'common\bootstrap\SetUp',
    ],

Everything seems to be in place, but something is wrong, but how to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis, 2018-03-18
@Exebeche

if you are an official participant of Eliseev's webiars, you can personally find out from him))))
Come in. To him on github and there he has classes according to the corresponding namespaces
'common\bootstrap\SetUp',
'frontend\bootstrap\SetUp

A
Andrey, 2018-03-18
@VladimirAndreev

Turn on debug mode, you will get the full trailer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question