maybe I just messed something up with namespaces, but I don't see it.
I tried to separate some classess in my Symfony App into a bundle.
The error I get in Symfony is:
Expected to find class "Shop\Admin\CategoryAdmin" in file "C:\wamp64\www\gall\bundles\Shop\src/Admin\CategoryAdmin.php" while importing services from resource "../bundles/Shop/src/*", but it was not found! Check the namespace prefix used with the resource in C:\wamp64\www\gall\config/services.yaml (which is loaded in resource "C:\wamp64\www\gall\config/services.yaml").
Here's my services.yaml:
Shop\:
resource: '../bundles/Shop/src/*'
exclude: '../bundles/Shop/src/{Entity,Migrations,Tests}'
Shop\Controller\:
resource: '../bundles/Shop/src/Controller'
tags: ['controller.service_arguments']
The file structure goes like this:
project (C:\wamp64\www\gall)
\- bundles
\- Shop
\- src
\- Admin
\- CategoryAdmin.php
\- config
\- services.yaml
And the CategoryAdmin.php file itself goes like this:
namespace Shop\Admin;
use Shop\Entity\Category;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Sonata\TranslationBundle\Filter\TranslationFieldFilter;
/**
* Class CategoryAdmin
* @package Shop\Admin
*/
class CategoryAdmin extends AbstractAdmin
{
{...}
}
Soo, the routes look exactly like these stated in the error. I don't understand why the FileLoader can't find this class, any ideas?