From 4684eb3505cead96509d4085b0496a83bc477a9c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 10 Jan 2023 16:40:09 +0100 Subject: [PATCH] Turn on "doctrine.orm.enable_lazy_ghost_objects" by default (#1140) --- .../2.8/config/packages/doctrine.yaml | 44 +++++++++++++++ doctrine/doctrine-bundle/2.8/manifest.json | 53 +++++++++++++++++++ doctrine/doctrine-bundle/2.8/post-install.txt | 4 ++ .../doctrine-bundle/2.8/src/Entity/.gitignore | 0 .../2.8/src/Repository/.gitignore | 0 5 files changed, 101 insertions(+) create mode 100644 doctrine/doctrine-bundle/2.8/config/packages/doctrine.yaml create mode 100644 doctrine/doctrine-bundle/2.8/manifest.json create mode 100644 doctrine/doctrine-bundle/2.8/post-install.txt create mode 100644 doctrine/doctrine-bundle/2.8/src/Entity/.gitignore create mode 100644 doctrine/doctrine-bundle/2.8/src/Repository/.gitignore diff --git a/doctrine/doctrine-bundle/2.8/config/packages/doctrine.yaml b/doctrine/doctrine-bundle/2.8/config/packages/doctrine.yaml new file mode 100644 index 00000000..e098899b --- /dev/null +++ b/doctrine/doctrine-bundle/2.8/config/packages/doctrine.yaml @@ -0,0 +1,44 @@ +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: '14' + orm: + auto_generate_proxy_classes: true + enable_lazy_ghost_objects: true + naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware + auto_mapping: true + mappings: + App: + is_bundle: false + 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 + + framework: + cache: + pools: + doctrine.result_cache_pool: + adapter: cache.app + doctrine.system_cache_pool: + adapter: cache.system diff --git a/doctrine/doctrine-bundle/2.8/manifest.json b/doctrine/doctrine-bundle/2.8/manifest.json new file mode 100644 index 00000000..95734076 --- /dev/null +++ b/doctrine/doctrine-bundle/2.8/manifest.json @@ -0,0 +1,53 @@ +{ + "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://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4\"", + "DATABASE_URL": "postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=14&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:-14}-alpine", + " environment:", + " POSTGRES_DB: ${POSTGRES_DB:-app}", + " # You should definitely change the password in production", + " POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}", + " POSTGRES_USER: ${POSTGRES_USER:-app}", + " 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\"" + ] + } + }, + "conflict": { + "doctrine/orm": "<2.14", + "symfony/dependency-injection": "<6.2", + "symfony/framework-bundle": "<5.3" + } +} diff --git a/doctrine/doctrine-bundle/2.8/post-install.txt b/doctrine/doctrine-bundle/2.8/post-install.txt new file mode 100644 index 00000000..bd9515ed --- /dev/null +++ b/doctrine/doctrine-bundle/2.8/post-install.txt @@ -0,0 +1,4 @@ + * Modify your DATABASE_URL config in .env + + * Configure the driver (postgresql) and + server_version (14) in config/packages/doctrine.yaml diff --git a/doctrine/doctrine-bundle/2.8/src/Entity/.gitignore b/doctrine/doctrine-bundle/2.8/src/Entity/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/doctrine/doctrine-bundle/2.8/src/Repository/.gitignore b/doctrine/doctrine-bundle/2.8/src/Repository/.gitignore new file mode 100644 index 00000000..e69de29b