From 97d75482ca85744133be3bef790a79f110af08e5 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Thu, 18 Feb 2021 08:30:42 -0500 Subject: [PATCH 1/4] add support for override_url --- .../2.3/config/packages/doctrine.yaml | 19 ++++++++ .../2.3/config/packages/prod/doctrine.yaml | 20 ++++++++ doctrine/doctrine-bundle/2.3/manifest.json | 48 +++++++++++++++++++ doctrine/doctrine-bundle/2.3/post-install.txt | 8 ++++ .../doctrine-bundle/2.3/src/Entity/.gitignore | 0 .../2.3/src/Repository/.gitignore | 0 6 files changed, 95 insertions(+) create mode 100644 doctrine/doctrine-bundle/2.3/config/packages/doctrine.yaml create mode 100644 doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.yaml create mode 100644 doctrine/doctrine-bundle/2.3/manifest.json create mode 100644 doctrine/doctrine-bundle/2.3/post-install.txt create mode 100644 doctrine/doctrine-bundle/2.3/src/Entity/.gitignore create mode 100644 doctrine/doctrine-bundle/2.3/src/Repository/.gitignore diff --git a/doctrine/doctrine-bundle/2.3/config/packages/doctrine.yaml b/doctrine/doctrine-bundle/2.3/config/packages/doctrine.yaml new file mode 100644 index 00000000..491dc6fb --- /dev/null +++ b/doctrine/doctrine-bundle/2.3/config/packages/doctrine.yaml @@ -0,0 +1,19 @@ +doctrine: + dbal: + override_url: true + 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: '13' + orm: + auto_generate_proxy_classes: true + naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware + auto_mapping: true + mappings: + App: + is_bundle: false + type: annotation + dir: '%kernel.project_dir%/src/Entity' + prefix: 'App\Entity' + alias: App diff --git a/doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.yaml b/doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.yaml new file mode 100644 index 00000000..084f59a0 --- /dev/null +++ b/doctrine/doctrine-bundle/2.3/config/packages/prod/doctrine.yaml @@ -0,0 +1,20 @@ +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 + result_cache_driver: + type: pool + pool: doctrine.result_cache_pool + +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/manifest.json b/doctrine/doctrine-bundle/2.3/manifest.json new file mode 100644 index 00000000..995a953a --- /dev/null +++ b/doctrine/doctrine-bundle/2.3/manifest.json @@ -0,0 +1,48 @@ +{ + "bundles": { + "Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle": ["all"] + }, + "copy-from-recipe": { + "config/": "%CONFIG_DIR%/", + "src/": "%SRC_DIR%/" + }, + "env": { + "#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url", + "#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://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7\"", + "DATABASE_URL": "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8" + }, + "dockerfile": [ + "RUN apk add --no-cache --virtual .pgsql-deps postgresql-dev; \\", + "\tdocker-php-ext-install -j$(nproc) pdo_pgsql; \\", + "\tapk add --no-cache --virtual .pgsql-rundeps so:libpq.so.5; \\", + "\tapk del .pgsql-deps" + ], + "docker-compose": { + "docker-compose.yml": { + "services": [ + "database:", + " image: postgres:${POSTGRES_VERSION:-13}-alpine", + " environment:", + " POSTGRES_DB: ${POSTGRES_DB:-app}", + " # You should definitely change the password in production", + " POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ChangeMe}", + " POSTGRES_USER: ${POSTGRES_USER:-symfony}", + " volumes:", + " - db-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!", + " # - ./docker/db/data:/var/lib/postgresql/data:rw" + ], + "volumes": ["db-data:"] + }, + "docker-compose.override.yml": { + "services": [ + "database:", + " ports:", + " - \"5432\"" + ] + } + } +} diff --git a/doctrine/doctrine-bundle/2.3/post-install.txt b/doctrine/doctrine-bundle/2.3/post-install.txt new file mode 100644 index 00000000..54ca1381 --- /dev/null +++ b/doctrine/doctrine-bundle/2.3/post-install.txt @@ -0,0 +1,8 @@ + + Database Configuration + + + * Modify your DATABASE_URL config in .env + + * Configure the driver (postgresql) and + server_version (13) in config/packages/doctrine.yaml diff --git a/doctrine/doctrine-bundle/2.3/src/Entity/.gitignore b/doctrine/doctrine-bundle/2.3/src/Entity/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/doctrine/doctrine-bundle/2.3/src/Repository/.gitignore b/doctrine/doctrine-bundle/2.3/src/Repository/.gitignore new file mode 100644 index 00000000..e69de29b From b8afbe9e4d9acc919555f358d6e46c4d0cd28b4a Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Tue, 23 Mar 2021 08:52:33 -0400 Subject: [PATCH 2/4] override dbname in test --- .../doctrine-bundle/2.3/config/packages/test/doctrine.yaml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml diff --git a/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml new file mode 100644 index 00000000..90537059 --- /dev/null +++ b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml @@ -0,0 +1,3 @@ +doctrine: + dbal: + dbname: main_test From 0b3e517e2e09742c7b9aa5a0b041d49eaadff104 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Tue, 23 Mar 2021 09:23:13 -0400 Subject: [PATCH 3/4] explain why we set dbname --- doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml index 90537059..165c0596 100644 --- a/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml +++ b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml @@ -1,3 +1,5 @@ doctrine: dbal: + # Overrides the database name in the test environment only + # "host", "port", "username", & "password" can also be set to override their respective url parts dbname: main_test From 0d5ad80a22019ec3f502a77ad60998399bf3203f Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Tue, 23 Mar 2021 11:08:40 -0400 Subject: [PATCH 4/4] add paratest support --- .../2.3/config/packages/test/doctrine.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml index 165c0596..a19e8d91 100644 --- a/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml +++ b/doctrine/doctrine-bundle/2.3/config/packages/test/doctrine.yaml @@ -1,5 +1,7 @@ -doctrine: - dbal: - # Overrides the database name in the test environment only - # "host", "port", "username", & "password" can also be set to override their respective url parts - dbname: main_test +#doctrine: +# dbal: +# # Overrides the database name in the test environment only +# # "host", "port", "username", & "password" can also be set to override their respective url parts +# # +# # If you're using ParaTest, "TEST_TOKEN" is set by ParaTest otherwise nothing is appended to the database name. +# dbname: main_test%env(default::TEST_TOKEN)%