Skip to content

Commit

Permalink
Use service name in the example
Browse files Browse the repository at this point in the history
By defining a new service for `Doctrine\Migrations\Version\DbalMigrationFactory` you overwrite the existing factory. The existing factory definition however is more complex when you have multiple connections defined. The connection is determined by the arguments passed to the console command. The original example breaks this behavior. 

By now the example is using the exiting service to decorate, allowing people with multiple connections to create a new decorator without breaking the behavior.
  • Loading branch information
jaapio committed Apr 8, 2024
1 parent 4c0f5a4 commit 13f3197
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Resources/doc/index.rst
Expand Up @@ -251,10 +251,9 @@ Here is an example on how to inject the service container into your migrations:
# config/services.yaml
services:
Doctrine\Migrations\Version\DbalMigrationFactory: ~
App\Migrations\Factory\MigrationFactoryDecorator:
decorates: Doctrine\Migrations\Version\DbalMigrationFactory
arguments: ['@App\Migrations\Factory\MigrationFactoryDecorator.inner', '@service_container']
decorates: 'doctrine.migrations.migrations_factory'
arguments: ['@.inner', '@service_container']
.. code-block:: php
Expand Down

0 comments on commit 13f3197

Please sign in to comment.