diff --git a/.env b/.env index 0379e65afb..d1ca29f12d 100644 --- a/.env +++ b/.env @@ -9,9 +9,15 @@ APP_SECRET=EDITME ###< symfony/framework-bundle ### ###> doctrine/doctrine-bundle ### -# Choose one of the following DBMS, adjust the server version and charset if needed +# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml +# +# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" +# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" +# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%?serverVersion=8&charset=utf8mb4 #DATABASE_URL=pgsql://postgres:postgres@127.0.0.1/sylius_%kernel.environment%?serverVersion=15&charset=utf8 +# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" ###< doctrine/doctrine-bundle ### ###> symfony/messenger ### diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index bd8c39307e..672a66d55c 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -1,16 +1,27 @@ -parameters: - # Adds a fallback DATABASE_URL if the env var is not set. - # This allows you to run cache:warmup even if your - # environment variables are not available yet. - # You should not need to change this value. - env(DATABASE_URL): '' - doctrine: dbal: url: '%env(resolve:DATABASE_URL)%' + # IMPORTANT: You MUST configure your server version, + # either here or in the DATABASE_URL env var (see .env file) + #server_version: '16' + + profiling_collect_backtrace: '%kernel.debug%' + use_savepoints: true orm: auto_generate_proxy_classes: '%kernel.debug%' + 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' + alias: App entity_managers: default: auto_mapping: true @@ -21,3 +32,54 @@ doctrine: dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App + +when@test: + doctrine: + dbal: + # "TEST_TOKEN" is typically set by ParaTest + dbname_suffix: '_test%env(default::TEST_TOKEN)%' + +when@prod: + 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 + entity_managers: + default: + metadata_cache_driver: + type: service + id: doctrine.system_cache_provider + query_cache_driver: + type: service + id: doctrine.system_cache_provider + result_cache_driver: + type: service + id: doctrine.result_cache_provider + + framework: + cache: + pools: + doctrine.result_cache_pool: + adapter: cache.app + doctrine.system_cache_pool: + adapter: cache.system + + services: + doctrine.result_cache_provider: + class: Doctrine\Common\Cache\Psr6\DoctrineProvider + public: false + factory: ['Doctrine\Common\Cache\Psr6\DoctrineProvider', 'wrap'] + arguments: + - '@doctrine.result_cache_pool' + doctrine.system_cache_provider: + class: Doctrine\Common\Cache\Psr6\DoctrineProvider + public: false + factory: [ 'Doctrine\Common\Cache\Psr6\DoctrineProvider', 'wrap' ] + arguments: + - '@doctrine.system_cache_pool' diff --git a/config/packages/prod/doctrine.yaml b/config/packages/prod/doctrine.yaml deleted file mode 100644 index 55ea750a14..0000000000 --- a/config/packages/prod/doctrine.yaml +++ /dev/null @@ -1,35 +0,0 @@ -doctrine: - orm: - entity_managers: - default: - metadata_cache_driver: - type: service - id: doctrine.system_cache_provider - query_cache_driver: - type: service - id: doctrine.system_cache_provider - result_cache_driver: - type: service - id: doctrine.result_cache_provider - -services: - doctrine.result_cache_provider: - class: Doctrine\Common\Cache\Psr6\DoctrineProvider - public: false - factory: ['Doctrine\Common\Cache\Psr6\DoctrineProvider', 'wrap'] - arguments: - - '@doctrine.result_cache_pool' - doctrine.system_cache_provider: - class: Doctrine\Common\Cache\Psr6\DoctrineProvider - public: false - factory: [ 'Doctrine\Common\Cache\Psr6\DoctrineProvider', 'wrap' ] - arguments: - - '@doctrine.system_cache_pool' - -framework: - cache: - pools: - doctrine.result_cache_pool: - adapter: cache.app - doctrine.system_cache_pool: - adapter: cache.system diff --git a/config/routes/annotations.yaml b/config/routes/attributes.yaml similarity index 100% rename from config/routes/annotations.yaml rename to config/routes/attributes.yaml diff --git a/symfony.lock b/symfony.lock index e974c406c1..f0f5e4d39f 100644 --- a/symfony.lock +++ b/symfony.lock @@ -6,12 +6,12 @@ "version": "4.0.0" }, "api-platform/core": { - "version": "2.5", + "version": "2.7", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", + "branch": "main", "version": "2.5", - "ref": "a93061567140e386f107be75340ac2aee3f86cbf" + "ref": "b86557ce5677fa855b1b2608f4a4bc4a8fed8be7" }, "files": [ "config/packages/api_platform.yaml", @@ -53,13 +53,14 @@ "version": "2.7.0" }, "doctrine/annotations": { - "version": "1.0", + "version": "2.0", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "1.0", - "ref": "cb4152ebcadbe620ea2261da1a1c5a9b8cea7672" - } + "branch": "main", + "version": "1.10", + "ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05" + }, + "files": [] }, "doctrine/cache": { "version": "v1.8.0" @@ -80,13 +81,18 @@ "version": "v0.5.3" }, "doctrine/doctrine-bundle": { - "version": "1.6", + "version": "2.11", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "1.6", - "ref": "ae205d5114e719deb64d2110f56ef910787d1e04" - } + "branch": "main", + "version": "2.10", + "ref": "c170ded8fc587d6bd670550c43dafcf093762245" + }, + "files": [ + "config/packages/doctrine.yaml", + "src/Entity/.gitignore", + "src/Repository/.gitignore" + ] }, "doctrine/doctrine-migrations-bundle": { "version": "1.2",