In Symfony 5.4, I am using the Easyadmin bundle, but during the multiple connections, I am facing some challenges.
In doctrine.yaml file,
doctrine:
dbal:
default_connection: default
connections:
default:
# configure these for your database server
url: '%env(resolve:DATABASE_URL)%'
wrapper_class: App\DBAL\MultiDbConnectionWrapper
driver: 'pdo_mysql'
# server_version: '5.7'
charset: utf8mb4
label:
# configure these for your database server
url: '%env(resolve:DATABASE_LABEL_URL)%'
wrapper_class: App\DBAL\MultiDbConnectionWrapper
driver: 'pdo_mysql'
# server_version: '5.7'
charset: utf8mb4
prod_scan:
# configure these for your database server
url: '%env(resolve:DATABASE_PROD_SCAN_URL)%'
wrapper_class: App\DBAL\MultiDbConnectionWrapper
driver: 'pdo_mysql'
# server_version: '5.7'
charset: utf8mb4
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '13'
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
RefArticlePrefix:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity/RefArticlePrefix'
prefix: 'App\Entity\RefArticlePrefix'
alias: RefArticlePrefix
QcUser:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity/QcUser'
prefix: 'App\Entity\QcUser'
alias: QcUser
label:
connection: label
mappings:
PrintArtLabAssoc:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity/PrintArtLabAssoc'
prefix: 'App\Entity\PrintArtLabAssoc'
alias: PrintArtLabAssoc
prod_scan:
connection: prod_scan
mappings:
Prodid:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity/Prodid'
prefix: 'App\Entity\Prodid'
alias: Prodid
ProdidCposant:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity/ProdidCposant'
prefix: 'App\Entity\ProdidCposant'
alias: ProdidCposant
when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system
Which is displaying the below error,
Unrecognized options "default_entity_manager, entity_managers" under "doctrine". Available options are "dbal", "form".
How can I resolve this error?
Thanx in advance.
is there any alternative for crud functionality, where the controller belongs to a different database?
CodePudding user response:
These options have moved under orm
.
https://symfony.com/doc/5.4/doctrine/multiple_entity_managers.html
CodePudding user response:
Okspen already gave the correct hint. Would like to extend this with an example how it would look like:
doctrine:
orm:
auto_generate_proxy_classes: false
default_entity_manager: default // <--
entity_managers: // <--
default:
connection: default
....
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool