From fd3a9fe4fec9cdc0bafcd1cf0ca351b1543d1d9c Mon Sep 17 00:00:00 2001 From: Dick Ittmann Date: Wed, 25 Jan 2023 12:02:11 +0100 Subject: [PATCH 1/5] Fix schema_assets_filter configuration docs The callable set as schemaAssetsFilter should return false for tables that you want filtered out See e.g. https://github.com/doctrine/dbal/blob/3.6.x/src/Configuration.php#L167 --- docs/en/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/configuration.rst b/docs/en/configuration.rst index b15da06b..fe9df6c4 100644 --- a/docs/en/configuration.rst +++ b/docs/en/configuration.rst @@ -302,7 +302,7 @@ The "schema_assets_filter" option can be used to exclude certain tables from bei 'configuration' => [ 'orm_default' => [ 'schema_assets_filter' => fn (string $tableName): bool => ( - in_array($tableName, ['migrations', 'doNotRemoveThisTable']); + ! in_array($tableName, ['migrations', 'doNotRemoveThisTable']); ), ], ], From c0e2256c8a65db60b68434fd8a2e55860c6ed36b Mon Sep 17 00:00:00 2001 From: Dick Ittmann Date: Wed, 25 Jan 2023 12:27:57 +0100 Subject: [PATCH 2/5] Fix syntax error, unexpected token ";" --- docs/en/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/configuration.rst b/docs/en/configuration.rst index fe9df6c4..bc84d6b6 100644 --- a/docs/en/configuration.rst +++ b/docs/en/configuration.rst @@ -302,7 +302,7 @@ The "schema_assets_filter" option can be used to exclude certain tables from bei 'configuration' => [ 'orm_default' => [ 'schema_assets_filter' => fn (string $tableName): bool => ( - ! in_array($tableName, ['migrations', 'doNotRemoveThisTable']); + ! in_array($tableName, ['migrations', 'doNotRemoveThisTable']) ), ], ], From a9b37a7fa3cbbc7d495a124db23a711ab51809ad Mon Sep 17 00:00:00 2001 From: Dick Ittmann Date: Mon, 6 Feb 2023 11:01:19 +0100 Subject: [PATCH 3/5] Update schema_assets_filter documentation --- docs/en/configuration.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/en/configuration.rst b/docs/en/configuration.rst index bc84d6b6..8e8c9f8a 100644 --- a/docs/en/configuration.rst +++ b/docs/en/configuration.rst @@ -293,7 +293,8 @@ module. How to Exclude Tables from a Schema Diff ---------------------------------------- -The "schema_assets_filter" option can be used to exclude certain tables from being created or deleted in a schema update: +The "schema_assets_filter" option can be used to exclude certain tables from being deleted in a schema update. +It should be set with a filter callback that will receive the table name and should return `false` for any tables that must be excluded. .. code:: php @@ -302,7 +303,7 @@ The "schema_assets_filter" option can be used to exclude certain tables from bei 'configuration' => [ 'orm_default' => [ 'schema_assets_filter' => fn (string $tableName): bool => ( - ! in_array($tableName, ['migrations', 'doNotRemoveThisTable']) + ! in_array($tableName, ['doNotRemoveThisTable', 'alsoDoNotRemoveThisTable']) ), ], ], From 1ca9cf4e20c0d7d83a64ef2cc56527d0cad8984d Mon Sep 17 00:00:00 2001 From: Dick Ittmann Date: Mon, 6 Feb 2023 18:27:54 +0100 Subject: [PATCH 4/5] Fix Static Analysis / PHPStan Fix Ignored error pattern #Parameter \#1 .* of method Doctrine\\Common\\DataFixtures\\Executor\\ORMExecutor::execute\(\)# in path tests/Paginator/AdapterTest.php was not matched in reported errors. --- phpstan.neon | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index de9f9407..ded2cec1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -17,4 +17,3 @@ parameters: path: tests/Options/ConfigurationOptionsTest.php includes: - vendor/phpstan/phpstan-phpunit/extension.neon - From d0a100d72c2e14411cd937758cd790e599a55836 Mon Sep 17 00:00:00 2001 From: Dick Ittmann Date: Mon, 6 Feb 2023 18:39:19 +0100 Subject: [PATCH 5/5] Update schema_assets_filter documentation --- docs/en/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/configuration.rst b/docs/en/configuration.rst index 8e8c9f8a..bf445ec7 100644 --- a/docs/en/configuration.rst +++ b/docs/en/configuration.rst @@ -294,7 +294,7 @@ How to Exclude Tables from a Schema Diff ---------------------------------------- The "schema_assets_filter" option can be used to exclude certain tables from being deleted in a schema update. -It should be set with a filter callback that will receive the table name and should return `false` for any tables that must be excluded. +It should be set with a filter callback that will receive the table name and should return `false` for any tables that must be excluded and `true` for any other tables. .. code:: php