Open danielspk opened 4 years ago
Sorry it works like this
// application console definitions...
// PSR-11 Doctrine ORM Entity Manager instance
$entityManager = $container->get('EntityManager');
$config = new XmlFile('migrations.xml');
$existingEntityManager = new ExistingEntityManager($entityManager);
$dependencyFactoryORM = DependencyFactory::fromEntityManager($config, $existingEntityManager);
$console->addCommands([
new DiffCommand($dependencyFactoryORM),
]);
This behavior would need to be documented.
Will this behavior be definitive or will it change in future pull requests?
well, if you create a dependency factory not knowing about the ORM but only about the connection, the diff
cannot work (unless you provide a custom implementation of the schema provider). This command is about diffing the existing database schema and the expected schema defined by the mapping.
Registering a dependency factory based on a connection only rather than based on an entity manager is equivalent to not registering the EntityManagerHelper
in the 2.x version of the library, where the diff
command would not work either.
The documentation, like https://www.doctrine-project.org/projects/doctrine-migrations/en/3.2/reference/generating-migrations.html#diffing-using-the-orm still uses diff
. Does it do that by accident? How is it currently possible to create a migration class from entity changes?
In Symfony ./console doctrine:migrations:diff --em=your-em
does the trick.
how do you know the em name?
BC Break Report
After update from version 2.2.1 to 3.0.1 the command diff nor found.
Summary
If I run:
The output is Command "diff" is not defined.
If I update my custom integration to:
The output is The entity manager is not available.
Previous behavior
Custom integration worked correctly when creating a helperset:
Currently that does not apply