Could not find the manager name parameter in the container. Tried the following parameter names: "doctrine.default_entity_manager"
wajaja opened this issue · 2 comments
Hi; I installed the bundle in symfony 4.2 but it does not work.
here are some details about the exception I'm getting:
by default after installing symfony; it's automatically configure orm and dbal; here is de default configuration for those bundle:
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
then concerning odm; I followed all the instructions for his installation including:
- MongoDB & php-driver
- alcaeus/mongo-php-adapter
- doctrine/mongodb-odm-bundle, etc.
doctrine_mongodb.yaml:
auto_generate_proxy_classes: true
auto_generate_hydrator_classes: true
connections:
default:
server: '%env(resolve:MONGODB_URL)%'
options: {}
default_database: '%env(resolve:MONGODB_DB)%'
document_managers:
default:
metadata_cache_driver:
type: redis
class: Doctrine\Common\Cache\RedisCache
host: 127.0.0.1
port: 6379
instance_class: Redis
auto_mapping: true
mappings:
AppUserBundle:
is_bundle: true
type: annotation
alias: User
fos_user:
db_driver: mongodb
firewall_name: api
when i try to login user i get the following exception and trace:
An exception occurred in driver: could not find driver
which is caused in this trace
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php (line 106)
in vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php->convertException (line 169)
in vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php::wrapException (line 155)
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php::driverException (line 28)
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php->connect (line 356)
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php->connect (line 889)
...
when i comment the code in doctrine.yml; I get this
Could not find the manager name parameter in the container. Tried the following parameter names: "doctrine.default_entity_manager"
So, what can i configure odm in symfony4
The error seems to be self-explanatory: you need to install PDO or pdo_mysql as it's missing in your system
Make sure to install the mongo driver too (if not already installed), or you'll get the same kind of error with odm.