Skip to content

Commit 7ad3df8

Browse files
committed
Merge branch '3.3.x' into 3.4.x
* 3.3.x: Update index.rst: Minor improvements at "Manual Tables" (#551) Add grammar constraint for phpcs.xml.dist (#572) Upgrade to PHPStan 2 (#565)
2 parents c755f5a + 6ad5ac6 commit 7ad3df8

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
"composer/semver": "^3.0",
3131
"phpunit/phpunit": "^8.5|^9.5",
3232
"doctrine/coding-standard": "^12",
33-
"phpstan/phpstan": "^1.4",
34-
"phpstan/phpstan-deprecation-rules": "^1",
35-
"phpstan/phpstan-phpunit": "^1",
36-
"phpstan/phpstan-strict-rules": "^1.1",
37-
"phpstan/phpstan-symfony": "^1.3",
33+
"phpstan/phpstan": "^1.4 || ^2",
34+
"phpstan/phpstan-deprecation-rules": "^1 || ^2",
35+
"phpstan/phpstan-phpunit": "^1 || ^2",
36+
"phpstan/phpstan-strict-rules": "^1.1 || ^2",
37+
"phpstan/phpstan-symfony": "^1.3 || ^2",
3838
"doctrine/orm": "^2.6 || ^3",
3939
"doctrine/persistence": "^2.0 || ^3 ",
4040
"symfony/phpunit-bridge": "^6.3 || ^7",

docs/index.rst

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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

470479
Note that if you have multiple connections configured then the ``schema_filter`` configuration
471480
will need to be placed per-connection.

phpcs.xml.dist

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0"?>
2-
<ruleset>
2+
<ruleset
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
5+
>
36
<arg name="basepath" value="."/>
47
<arg name="extensions" value="php"/>
58
<arg name="parallel" value="80"/>

0 commit comments

Comments
 (0)