psr-container-doctrine
psr-container-doctrine copied to clipboard
Doctrine Migrations - Missing configuration in cli-config.php
The current documentation suggests the following configuration:
return new HelperSet(
[
'em' => new EntityManagerHelper(
$container->get('doctrine.entity_manager.orm_default')
),
]
);
However, when I try to run php vendor/bin/doctrine-migrations migrations:status
, it says that I have to provide a configuration for the database. The exact error is the following: You have to specify a --db-configuration file or pass a Database Connection as a dependency to the Migrations.
. Shouldn't we actually make it as follows?
/** @var EntityManagerInterface $entityManager */
$entityManager = $container->get('doctrine.entity_manager.orm_default');
return new HelperSet(
[
'em' => new EntityManagerHelper(
$entityManager
),
'configuration' => new ConfigurationHelper(
$entityManager->getConnection(),
$container->get('doctrine.migrations.orm_default')
),
]
);
I thought the 'em'
key would suffice: is this a BC break in the upstram library? Similar to #27, I think we need to cement these with runnable examples: unit tests will just not cut it long-term.
I don't think it's a BC break in the upstream library. Before I used the psr-container-doctrine
implementation for the migrations, I had my own factory to create the configuration and I still needed this entry in the helper set, so I think it was always required.