diff --git a/.env.dist b/.env.dist index 93b6c07234..ba83d89b7d 100644 --- a/.env.dist +++ b/.env.dist @@ -1,8 +1,13 @@ # Set variables here that may be different on each deployment target of the app, e.g. development, staging, production. # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration -###> doctrine/doctrine-bundle ### -# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# 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="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" DATABASE_HOST='{{DATABASE_HOST}}' DATABASE_PORT='{{DATABASE_PORT}}' DATABASE_NAME='{{DATABASE_NAME}}' diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index d5c8a049a4..b12a3dc87f 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -23,6 +23,9 @@ doctrine: use_savepoints: false 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 query_cache_driver: @@ -32,6 +35,24 @@ doctrine: type: pool pool: doctrine.result_cache_pool mappings: + chamilo_core: + type: attribute + is_bundle: false + dir: '%kernel.project_dir%/src/CoreBundle/Entity' + prefix: 'Chamilo\CoreBundle\Entity' + alias: ChamiloCoreBundle + chamilo_course: + type: attribute + is_bundle: false + dir: '%kernel.project_dir%/src/CourseBundle/Entity' + prefix: 'Chamilo\CourseBundle\Entity' + alias: ChamiloCourseBundle + chamilo_lti: + type: attribute + is_bundle: false + dir: '%kernel.project_dir%/src/LtiBundle/Entity' + prefix: 'Chamilo\LtiBundle\Entity' + alias: ChamiloLtiBundle gedmo_translatable: type: annotation prefix: Gedmo\Translatable\Entity @@ -56,6 +77,7 @@ doctrine: dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Tree/Entity" alias: GedmoTree # (optional) it will default to the name set for the mapping is_bundle: false + dql: string_functions: MONTH: DoctrineExtensions\Query\Mysql\Month @@ -64,4 +86,32 @@ doctrine: softdeleteable: class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter enabled: true - enable_lazy_ghost_objects: true + +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' + 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/config/packages/prod/doctrine.yaml b/config/packages/prod/doctrine.yaml deleted file mode 100644 index 084f59a05d..0000000000 --- a/config/packages/prod/doctrine.yaml +++ /dev/null @@ -1,20 +0,0 @@ -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/symfony.lock b/symfony.lock index 0a23081c28..414a18ed91 100644 --- a/symfony.lock +++ b/symfony.lock @@ -46,8 +46,8 @@ "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", - "version": "2.4", - "ref": "91690c0a440faba1a3676256bcca2b4aa9f55b72" + "version": "2.12", + "ref": "32f890075233ac4a1176e848a0f8e932ac6536d6" }, "files": [ "config/packages/doctrine.yaml",