During configuration my symfony app I've got an error about wrong namespaces for my controllers, but I'm sure that file exist in the path which was displaying in the error message and my configuration seems to be correct
Expected to find class "App\Controller\AccountController" in file "/var/www/html/src/App/Controller/AccountController.php" while importing services from resource "../src/App/*", but it was not found! Check the namespace prefix used with the resource in /var/www/html/config/services.yaml (which is loaded in resource "/var/www/html/config/services.yaml").
/var/www/html/config/services.yaml file
services:
_defaults:
autowire: true
autoconfigure: true
App\:
resource: '../src/App/*'
exclude: '../src/App/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
App\Controller\:
resource: '../src/App/Controller'
tags: ['controller.service_arguments']
composer.json
"autoload": {
"psr-4": {
"App\\": "src/App/",
"": "src/"
}
}
Folder structure
/src:
/App:
/Controller:
AccountController.php
controller namespace
namespace App\Controller;