schranz-php-recipes / symfony-recipes-php

Provides https://github.com/symfony/recipes as PHP instead of YAML configs.
MIT License
13 stars 3 forks source link

Update recipes 2024-04-20 #90

Closed symfony-php-recipes-bot closed 6 months ago

symfony-php-recipes-bot commented 6 months ago
Q A
License MIT

The Symfony Recipes changed with version . This PR contains the new definition for recipes.

github-actions[bot] commented 6 months ago

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/schranz-php-recipes/symfony-recipes-php/flex/pull-90/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/schranz-php-recipes/symfony-recipes-php/flex/pull-90/index.json
  2. Install the package(s) related to this recipe:

    composer req 'symfony/flex:^1.16'
    composer req 'doctrine/doctrine-bundle:^2.12'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. I'm going keep this comment up to date with any updates of the attached patch.

doctrine/doctrine-bundle

1.6 vs 1.12 ```diff diff --git a/doctrine/doctrine-bundle/1.6/config/packages/doctrine.php b/doctrine/doctrine-bundle/1.12/config/packages/doctrine.php index c93732f..aa66d26 100644 --- a/doctrine/doctrine-bundle/1.6/config/packages/doctrine.php +++ b/doctrine/doctrine-bundle/1.12/config/packages/doctrine.php @@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { ], 'orm' => [ 'auto_generate_proxy_classes' => true, - 'naming_strategy' => 'doctrine.orm.naming_strategy.underscore', + 'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware', 'auto_mapping' => true, 'mappings' => [ 'App' => [ diff --git a/doctrine/doctrine-bundle/1.6/config/packages/prod/doctrine.php b/doctrine/doctrine-bundle/1.12/config/packages/prod/doctrine.php index a6dfabd..dd81ae3 100644 --- a/doctrine/doctrine-bundle/1.6/config/packages/prod/doctrine.php +++ b/doctrine/doctrine-bundle/1.12/config/packages/prod/doctrine.php @@ -3,37 +3,26 @@ declare(strict_types=1); use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; -use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->extension('doctrine', [ 'orm' => [ 'auto_generate_proxy_classes' => false, 'metadata_cache_driver' => [ - 'type' => 'service', - 'id' => 'doctrine.system_cache_provider', + 'type' => 'pool', + 'pool' => 'doctrine.system_cache_pool', ], 'query_cache_driver' => [ - 'type' => 'service', - 'id' => 'doctrine.system_cache_provider', + 'type' => 'pool', + 'pool' => 'doctrine.system_cache_pool', ], 'result_cache_driver' => [ - 'type' => 'service', - 'id' => 'doctrine.result_cache_provider', + 'type' => 'pool', + 'pool' => 'doctrine.result_cache_pool', ], ], ]); - $services = $containerConfigurator->services(); - - $services->set('doctrine.result_cache_provider', 'Symfony\Component\Cache\DoctrineProvider') - ->private() - ->args([service('doctrine.result_cache_pool')]); - - $services->set('doctrine.system_cache_provider', 'Symfony\Component\Cache\DoctrineProvider') - ->private() - ->args([service('doctrine.system_cache_pool')]); - $containerConfigurator->extension('framework', [ 'cache' => [ 'pools' => [ diff --git a/doctrine/doctrine-bundle/1.6/manifest.json b/doctrine/doctrine-bundle/1.12/manifest.json index 254981d..b39e0ab 100644 --- a/doctrine/doctrine-bundle/1.6/manifest.json +++ b/doctrine/doctrine-bundle/1.12/manifest.json @@ -11,8 +11,8 @@ "#2": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", "#3": "", "#4": "DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/data.db\"", - "#5": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8\"", - "DATABASE_URL": "postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" + "#5": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/db_name?serverVersion=8\"", + "DATABASE_URL": "postgresql://app:!ChangeMe!@127.0.0.1:5432/db_name?serverVersion=16&charset=utf8" }, "dockerfile": [ "RUN install-php-extensions pdo_pgsql" ```
1.12 vs 2.0 ```diff diff --git a/doctrine/doctrine-bundle/1.12/config/packages/doctrine.php b/doctrine/doctrine-bundle/2.0/config/packages/doctrine.php index aa66d26..cf8cb98 100644 --- a/doctrine/doctrine-bundle/1.12/config/packages/doctrine.php +++ b/doctrine/doctrine-bundle/2.0/config/packages/doctrine.php @@ -8,10 +8,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->extension('doctrine', [ 'dbal' => [ 'url' => '%env(resolve:DATABASE_URL)%', - 'charset' => 'utf8mb4', - 'default_table_options' => [ - 'collate' => 'utf8mb4_unicode_ci', - ], + 'use_savepoints' => true, ], 'orm' => [ 'auto_generate_proxy_classes' => true, diff --git a/doctrine/doctrine-bundle/1.12/manifest.json b/doctrine/doctrine-bundle/2.0/manifest.json index b39e0ab..254981d 100644 --- a/doctrine/doctrine-bundle/1.12/manifest.json +++ b/doctrine/doctrine-bundle/2.0/manifest.json @@ -11,8 +11,8 @@ "#2": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", "#3": "", "#4": "DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/data.db\"", - "#5": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/db_name?serverVersion=8\"", - "DATABASE_URL": "postgresql://app:!ChangeMe!@127.0.0.1:5432/db_name?serverVersion=16&charset=utf8" + "#5": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8\"", + "DATABASE_URL": "postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" }, "dockerfile": [ "RUN install-php-extensions pdo_pgsql" ```
2.0 vs 2.3 ```diff diff --git a/doctrine/doctrine-bundle/2.0/config/packages/prod/doctrine.php b/doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.php index dd81ae3..20e0bf6 100644 --- a/doctrine/doctrine-bundle/2.0/config/packages/prod/doctrine.php +++ b/doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.php @@ -8,10 +8,6 @@ return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->extension('doctrine', [ 'orm' => [ 'auto_generate_proxy_classes' => false, - 'metadata_cache_driver' => [ - 'type' => 'pool', - 'pool' => 'doctrine.system_cache_pool', - ], 'query_cache_driver' => [ 'type' => 'pool', 'pool' => 'doctrine.system_cache_pool', diff --git a/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.php b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.php new file mode 100644 index 0000000..d1f2212 --- /dev/null +++ b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.php @@ -0,0 +1,13 @@ +extension('doctrine', [ + 'dbal' => [ + 'dbname' => 'main_test%env(default::TEST_TOKEN)%', + ], + ]); +}; diff --git a/doctrine/doctrine-bundle/2.0/manifest.json b/doctrine/doctrine-bundle/2.3/manifest.json index 254981d..7203651 100644 --- a/doctrine/doctrine-bundle/2.0/manifest.json +++ b/doctrine/doctrine-bundle/2.3/manifest.json @@ -11,7 +11,7 @@ "#2": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", "#3": "", "#4": "DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/data.db\"", - "#5": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8\"", + "#5": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4\"", "DATABASE_URL": "postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" }, "dockerfile": [ ```
2.3 vs 2.4 ```diff diff --git a/doctrine/doctrine-bundle/2.3/config/packages/doctrine.php b/doctrine/doctrine-bundle/2.4/config/packages/doctrine.php index cf8cb98..cd47e21 100644 --- a/doctrine/doctrine-bundle/2.3/config/packages/doctrine.php +++ b/doctrine/doctrine-bundle/2.4/config/packages/doctrine.php @@ -17,7 +17,6 @@ return static function (ContainerConfigurator $containerConfigurator): void { 'mappings' => [ 'App' => [ 'is_bundle' => false, - 'type' => 'annotation', 'dir' => '%kernel.project_dir%/src/Entity', 'prefix' => 'App\Entity', 'alias' => 'App', @@ -25,4 +24,39 @@ return static function (ContainerConfigurator $containerConfigurator): void { ], ], ]); + if ($containerConfigurator->env() === 'test') { + $containerConfigurator->extension('doctrine', [ + 'dbal' => [ + 'dbname_suffix' => '_test%env(default::TEST_TOKEN)%', + ], + ]); + } + if ($containerConfigurator->env() === 'prod') { + $containerConfigurator->extension('doctrine', [ + 'orm' => [ + 'auto_generate_proxy_classes' => false, + 'proxy_dir' => '%kernel.build_dir%/doctrine/orm/Proxies', + 'query_cache_driver' => [ + 'type' => 'pool', + 'pool' => 'doctrine.system_cache_pool', + ], + 'result_cache_driver' => [ + 'type' => 'pool', + 'pool' => 'doctrine.result_cache_pool', + ], + ], + ]); + $containerConfigurator->extension('framework', [ + 'cache' => [ + 'pools' => [ + 'doctrine.result_cache_pool' => [ + 'adapter' => 'cache.app', + ], + 'doctrine.system_cache_pool' => [ + 'adapter' => 'cache.system', + ], + ], + ], + ]); + } }; diff --git a/doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.php b/doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.php deleted file mode 100644 index 20e0bf6..0000000 --- a/doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.php +++ /dev/null @@ -1,34 +0,0 @@ -extension('doctrine', [ - 'orm' => [ - 'auto_generate_proxy_classes' => false, - 'query_cache_driver' => [ - 'type' => 'pool', - 'pool' => 'doctrine.system_cache_pool', - ], - 'result_cache_driver' => [ - 'type' => 'pool', - 'pool' => 'doctrine.result_cache_pool', - ], - ], - ]); - - $containerConfigurator->extension('framework', [ - 'cache' => [ - 'pools' => [ - 'doctrine.result_cache_pool' => [ - 'adapter' => 'cache.app', - ], - 'doctrine.system_cache_pool' => [ - 'adapter' => 'cache.system', - ], - ], - ], - ]); -}; diff --git a/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.php b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.php deleted file mode 100644 index d1f2212..0000000 --- a/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.php +++ /dev/null @@ -1,13 +0,0 @@ -extension('doctrine', [ - 'dbal' => [ - 'dbname' => 'main_test%env(default::TEST_TOKEN)%', - ], - ]); -}; diff --git a/doctrine/doctrine-bundle/2.3/manifest.json b/doctrine/doctrine-bundle/2.4/manifest.json index 7203651..c022d2f 100644 --- a/doctrine/doctrine-bundle/2.3/manifest.json +++ b/doctrine/doctrine-bundle/2.4/manifest.json @@ -41,5 +41,8 @@ " - \"5432\"" ] } + }, + "conflict": { + "symfony/framework-bundle": "<5.3" } } ```
2.4 vs 2.8 ```diff diff --git a/doctrine/doctrine-bundle/2.4/config/packages/doctrine.php b/doctrine/doctrine-bundle/2.8/config/packages/doctrine.php index cd47e21..559bdf9 100644 --- a/doctrine/doctrine-bundle/2.4/config/packages/doctrine.php +++ b/doctrine/doctrine-bundle/2.8/config/packages/doctrine.php @@ -12,6 +12,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { ], 'orm' => [ 'auto_generate_proxy_classes' => true, + 'enable_lazy_ghost_objects' => true, 'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware', 'auto_mapping' => true, 'mappings' => [ diff --git a/doctrine/doctrine-bundle/2.4/manifest.json b/doctrine/doctrine-bundle/2.8/manifest.json index c022d2f..1d8996a 100644 --- a/doctrine/doctrine-bundle/2.4/manifest.json +++ b/doctrine/doctrine-bundle/2.8/manifest.json @@ -11,7 +11,8 @@ "#2": "IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml", "#3": "", "#4": "DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/data.db\"", - "#5": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4\"", + "#5": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4\"", + "#6": "DATABASE_URL=\"mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4\"", "DATABASE_URL": "postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" }, "dockerfile": [ @@ -43,6 +44,8 @@ } }, "conflict": { + "doctrine/orm": "<2.14", + "symfony/dependency-injection": "<6.2", "symfony/framework-bundle": "<5.3" } } ```
2.8 vs 2.9 ```diff ```
2.9 vs 2.10 ```diff diff --git a/doctrine/doctrine-bundle/2.9/config/packages/doctrine.php b/doctrine/doctrine-bundle/2.10/config/packages/doctrine.php index 559bdf9..359e2e0 100644 --- a/doctrine/doctrine-bundle/2.9/config/packages/doctrine.php +++ b/doctrine/doctrine-bundle/2.10/config/packages/doctrine.php @@ -8,15 +8,19 @@ return static function (ContainerConfigurator $containerConfigurator): void { $containerConfigurator->extension('doctrine', [ 'dbal' => [ 'url' => '%env(resolve:DATABASE_URL)%', + 'profiling_collect_backtrace' => '%kernel.debug%', 'use_savepoints' => true, ], 'orm' => [ 'auto_generate_proxy_classes' => true, 'enable_lazy_ghost_objects' => true, + 'report_fields_where_declared' => true, + 'validate_xml_mapping' => true, 'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware', 'auto_mapping' => true, 'mappings' => [ 'App' => [ + 'type' => 'attribute', 'is_bundle' => false, 'dir' => '%kernel.project_dir%/src/Entity', 'prefix' => 'App\Entity', ```
2.10 vs 2.12 ```diff diff --git a/doctrine/doctrine-bundle/2.10/config/packages/doctrine.php b/doctrine/doctrine-bundle/2.12/config/packages/doctrine.php index 359e2e0..7597278 100644 --- a/doctrine/doctrine-bundle/2.10/config/packages/doctrine.php +++ b/doctrine/doctrine-bundle/2.12/config/packages/doctrine.php @@ -27,6 +27,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { 'alias' => 'App', ], ], + 'controller_resolver' => [ + 'auto_mapping' => true, + ], ], ]); if ($containerConfigurator->env() === 'test') { diff --git a/doctrine/doctrine-bundle/2.10/manifest.json b/doctrine/doctrine-bundle/2.12/manifest.json index 1d8996a..d7f4f04 100644 --- a/doctrine/doctrine-bundle/2.10/manifest.json +++ b/doctrine/doctrine-bundle/2.12/manifest.json @@ -28,6 +28,11 @@ " # You should definitely change the password in production", " POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}", " POSTGRES_USER: ${POSTGRES_USER:-app}", + " healthcheck:", + " test: [\"CMD\", \"pg_isready -U ${POSTGRES_USER:-app}\"]", + " timeout: 5s", + " retries: 5", + " start_period: 60s", " volumes:", " - database_data:/var/lib/postgresql/data:rw", " # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!", ```