-1

I changed directory structure in Symfony and I want it to work without success.

Autoload:

"autoload": {
        "psr-4": {
            "D2D\\": "src/"
        }
    },

Front controller (public\index.php):

<?php

declare(strict_types=1);

use D2D\Shared\Infrastructure\SymfonyKernel;
use Symfony\Component\HttpFoundation\Request;

require dirname(__DIR__).'/vendor/autoload.php';

$kernel = new SymfonyKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Kernel (src\Shared\Infrastructure\SymfonyKernel.php):

<?php

namespace D2D\Shared\Infrastructure;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

class SymfonyKernel extends BaseKernel
{
    use MicroKernelTrait;

    ... everything else as default
}

Error I get:

Attempted to load class "Kernel" from namespace "App". Did you forget a "use" statement for "Symfony\Component\HttpKernel\Kernel"?

1 Answers1

0

I forgot that cli commands are going through bin/console so I had to change namespace for SymfonyKernel there because it's separate environment that creates kernel.