My Symfony4 app is working fine in dev environment but not in production, i can't login (using FosUserBundle). After enabling debug and profiler toolbar in production (beacause it doesn't write any log) i've found the error
The class 'App\Entity\FintelUtility\User\User' was not found in the chain configured namespaces FOS\UserBundle\Model
The class was not found in the chain configured namespaces
I've cleared the cache and i've checked mapping info of doctrine
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
I don't know how to map those three entities that are missing.
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
Ther's no config/packages/dev/doctrine.yaml but prod 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
I've tried also php bin/console cache:warmup --env=prod --no-debug but it didn't help
Any idea?
EDIT
I've changed "mssql_fgel_utility" entity manager to "default" and it worked for prod but then it doesn't work for dev
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