FosUserBundle / Symfony 4 - 在链配置的命名空间中找不到 class

FosUserBundle / Symfony 4 - The class was not found in the chain configured namespaces

我的 Symfony4 应用程序在开发环境中运行良好但在生产环境中运行不正常,我无法登录(使用 FosUserBundle)。在生产中启用调试和探查器工具栏后(因为它不写任何日志)我发现了错误

The class 'App\Entity\FintelUtility\User\User' was not found in the chain configured namespaces FOS\UserBundle\Model

在链配置的命名空间中找不到 class

我已经清除了缓存并且我已经检查了学说的映射信息

php bin/console doctrine:mapping:info --env=prod
 Found 2 mapped entities:
 [OK]   FOS\UserBundle\Model\Group
 [OK]   FOS\UserBundle\Model\User
wwwfintel@fnt-srvweb01:~/s4fgel$ php bin/console doctrine:mapping:info --env=dev                             
 Found 5 mapped entities:
 [OK]   App\Entity\FintelUtility\QuoteOfTheDay
 [OK]   App\Entity\FintelUtility\User\Group
 [OK]   App\Entity\FintelUtility\User\User
 [OK]   FOS\UserBundle\Model\Group
 [OK]   FOS\UserBundle\Model\User

我不知道如何映射缺少的那三个实体。

config/packages/doctrine.yaml

# Doctrine Configuration
doctrine:
    dbal:
        default_connection: mssql_fgel_utility
        connections:
            mssql_fgel_utility:
                driver:   ~
                driver_class: "%fgelutil_database_driver_class%"
                host:     "%fgelutil_database_host%"
                dbname:   "%fgelutil_database_name%"
                user:     "%fgelutil_database_user%"
                password: "%fgelutil_database_password%"
        types:
            datetime_key: 'App\Type\DateTimeKeyType'
    orm:
        default_entity_manager: mssql_fgel_utility
        entity_managers:
            #################################
            # Update schema only with this em
            #################################
            mssql_fgel_utility:
                connection: mssql_fgel_utility
                mappings:
                    FintelUtility:
                        type:     "annotation"    
                        # The directory for entity (relative to bundle path)
                        dir:      '%kernel.project_dir%/src/Entity/FintelUtility'   
                        prefix:   'App\Entity\FintelUtility'
                        is_bundle: false

没有 config/packages/dev/doctrine.yaml 但产品 config/packages/prod/doctrine.yaml

doctrine:
    orm:
        metadata_cache_driver:
            type: service
            id: doctrine.system_cache_provider
        query_cache_driver:
            type: service
            id: doctrine.system_cache_provider
        result_cache_driver:
            type: service
            id: doctrine.result_cache_provider

services:
    doctrine.result_cache_provider:
        class: Symfony\Component\Cache\DoctrineProvider
        public: false
        arguments:
            - '@doctrine.result_cache_pool'
    doctrine.system_cache_provider:
        class: Symfony\Component\Cache\DoctrineProvider
        public: false
        arguments:
            - '@doctrine.system_cache_pool'

framework:
    cache:
        pools:
            doctrine.result_cache_pool:
                adapter: cache.app
            doctrine.system_cache_pool:
                adapter: cache.system

我也试过 php bin/console cache:warmup --env=prod --no-debug 但是没用

有什么想法吗?

编辑

我已将 "mssql_fgel_utility" 实体管理器更改为 "default",它适用于产品,但 然后它不适用于开发

orm:
    default_entity_manager: mssql_fgel_utility
    entity_managers:
        #################################
        # Update schema only with this em
        #################################
        # THIS WAS WRONG EVEN IF I DON'T KNOW WHY
        # mssql_fgel_utility:
        #################################
        default: #changed to this

您写道:

I've cleared the cache and i've checked mapping info of doctrine

是 Symfony 缓存还是 Doctrine 缓存?如果不是 Doctrine 缓存,清除它并尝试命令 php bin/console do:sc:va 检查映射并检查数据库是否与映射同步,如果不同步则使 php bin/console do:sc:up --force --env=prod

我已将 "mssql_fgel_utility" 实体管理器更改为 "default" 并且有效

orm:
    default_entity_manager: default
    entity_managers:
        #################################
        # Update schema only with this em
        #################################
        # THIS WAS WRONG EVEN IF I DON'T KNOW WHY
        # mssql_fgel_utility:
        #################################
        default: #changed to this

您必须将 "mssql_fgel_utility" 实体管理器更改为 "default" 并删除 "default_entity_manager: mssql_fgel_utility",它将适用于 devprod