-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for --complete #526
base: 3.4.x
Are you sure you want to change the base?
Conversation
<service id="doctrine_migrations.schema_filter_listener" class="Doctrine\Migrations\EventListener\SchemaFilterListener"> | ||
<tag name="kernel.event_listener" event="console.command" method="onConsoleCommand" /> | ||
<tag name="doctrine.dbal.schema_filter" /> | ||
</service> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the part I am not sure about, because I have been enable to test it. I've tried accessing the schema filter manager definition in order to inspect it after the compiler pass, like this:
public function testItRegistersTheSchemaFilterListener(): void
{
$container = $this->getContainer([]);
$container->getDefinition('doctrine.dbal.schema_asset_filter_manager')->setPublic(true);
$container->compile();
$container->get('doctrine.dbal.schema_asset_filter_manager');
}
That last line results in
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "doctrine.dbal.schema_asset_filter_manager" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
Any ideas how to test this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doctrine.dbal.schema_asset_filter_manager
is defined as an abstract. The container builder removes unused and/or abstract definitions during its compilation causing the service to be hidden.
An example fix, not per se the wanted fix, could be:
$container
->getDefinition('doctrine.dbal.schema_asset_filter_manager')
->setAbstract(false)
->setArgument(0, [])
->setPublic(true);
feca975
to
2cfbb72
Compare
8ad6f64
to
656c9ee
Compare
Cc @FlyingDR :) |
When using orm:schema-tool:update together with --complete, all assets not described by the current metadata is dropped. This is an issue when using doctrine/migrations, because not using that option is deprecated, and because when it is used, the table that holds the migrations is dropped as well since it is not described by ORM metadata. A solution to that is configuring an asset filter that filters out the metadata table except when running commands inside the migrations namespace.
656c9ee
to
c356a12
Compare
When using orm:schema-tool:update together with --complete, all assets not described by the current metadata is dropped.
This is an issue when using doctrine/migrations, because not using that option is deprecated, and because when it is used, the table that holds the migrations is dropped as well since it is not described by ORM metadata.
A solution to that is configuring an asset filter that filters out the metadata table except when running commands inside the migrations namespace.
How can I test this?
composer config repositories.greg0ire vcs https://github.com/greg0ire/DoctrineMigrationsBundle composer require doctrine/doctrine-migrations-bundle "dev-complete-compat as 3.3.0"