@@ -24,7 +24,7 @@ If you don't use `Symfony Flex`_, you must enable the bundle manually in the app
2424.. code-block :: php
2525
2626 // config/bundles.php
27- // in older Symfony apps, enable the bundle in app/AppKernel.php
27+
2828 return [
2929 // ...
3030 Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
@@ -245,11 +245,13 @@ Here is an example on how to inject the service container into your migrations:
245245 .. code-block :: yaml
246246
247247 # config/packages/doctrine_migrations.yaml
248+
248249 doctrine_migrations :
249250 services :
250251 ' Doctrine\Migrations\Version\MigrationFactory ' : ' App\Migrations\Factory\MigrationFactoryDecorator'
251252
252253 # config/services.yaml
254+
253255 services :
254256 App\Migrations\Factory\MigrationFactoryDecorator :
255257 decorates : ' doctrine.migrations.migrations_factory'
@@ -339,6 +341,7 @@ for Doctrine's ORM:
339341 .. code-block :: php-annotations
340342
341343 // src/Entity/User.php
344+
342345 namespace App\Entity;
343346
344347 use Doctrine\ORM\Mapping as ORM;
@@ -364,6 +367,7 @@ for Doctrine's ORM:
364367 .. code-block :: yaml
365368
366369 # config/doctrine/User.orm.yaml
370+
367371 App\Entity\User :
368372 type : entity
369373 table : user
@@ -380,6 +384,7 @@ for Doctrine's ORM:
380384 .. code-block :: xml
381385
382386 <!-- config/doctrine/User.orm.xml -->
387+
383388 <doctrine-mapping xmlns =" http://doctrine-project.org/schemas/orm/doctrine-mapping"
384389 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
385390 xsi : schemaLocation =" http://doctrine-project.org/schemas/orm/doctrine-mapping
@@ -431,41 +436,45 @@ If you don't want to use this workflow and instead create your schema via
431436
432437 Otherwise Doctrine will try to run all migrations, which probably will not work.
433438
434- Manual Tables
435- -------------
439+ Manual Tables Not Managed by Doctrine
440+ -------------------------------------
436441
437- It is a common use case, that in addition to your generated database structure
438- based on your doctrine entities you might need custom tables. By default such
439- tables will be removed by the ``doctrine:migrations:diff `` command.
442+ In addition to your generated database structure based on your doctrine entities you might need some custom tables.
443+ By default such tables will be marked for removal by the ``doctrine:migrations:diff `` command.
440444
441- If you follow a specific scheme you can configure doctrine/dbal to ignore those
442- tables. Let's say all custom tables will be prefixed by ``t_ ``. In this case you
443- just have to add the following configuration option to your doctrine configuration:
445+ Here's how you can configure ``doctrine/dbal `` to ignore some tables:
444446
445447.. configuration-block ::
446448
447449 .. code-block :: yaml
448450
451+ # config/packages/doctrine.yaml
452+
449453 doctrine :
450454 dbal :
451- schema_filter : ~^(?!t_)~
455+ schema_filter : ~^(?!t_)~ # Ignore all tables prefixed by `t_`
452456
453457 .. code-block :: xml
454458
459+ <!-- config/packages/doctrine.xml -->
460+
461+ <!-- Ignore all tables prefixed by `t_` -->
455462 <doctrine : dbal schema-filter =" ~^(?!t_)~" />
456463
457464
458465 .. code-block :: php
459466
467+ // config/packages/doctrine.php
468+
460469 $container->loadFromExtension('doctrine', array(
461- 'dbal' => array(
462- 'schema_filter' => '~^(?!t_)~',
470+ 'dbal' => [
471+ 'schema_filter' => '~^(?!t_)~', // Ignore all tables prefixed by `t_`
463472 // ...
464- ) ,
473+ ] ,
465474 // ...
466475 ));
467476
468- This ignores the tables, and any named objects such as sequences, on the DBAL level and they will be ignored by the diff command.
477+ This ignores the tables, and any named objects such as sequences, on the DBAL level and they will be ignored by the `` diff `` command.
469478
470479Note that if you have multiple connections configured then the ``schema_filter `` configuration
471480will need to be placed per-connection.
0 commit comments