doctrine:
  dbal:
    url: '%env(DATABASE_URL)%'
    driver_class: App\Doctrine\DBAL\Driver\PDO\MySQL\Driver
    options:
      !php/const PDO::MYSQL_ATTR_SSL_CA: '%env(resolve:DATABASE_SSL_CA_CERT)%'
      !php/const PDO::MYSQL_ATTR_SSL_CERT: '%env(resolve:DATABASE_SSL_CLIENT_CERT)%'
      !php/const PDO::MYSQL_ATTR_SSL_KEY: '%env(resolve:DATABASE_SSL_CLIENT_KEY)%'

    # IMPORTANT: You MUST configure your server version,
    # either here or in the DATABASE_URL env var (see .env file)
    #server_version: '16'
    use_savepoints: true
  orm:
    default_entity_manager: default
    auto_generate_proxy_classes: true
    entity_managers:
      default:
        connection: default
        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
        dql:
          string_functions:
            JSON_EXTRACT: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Mysql\JsonExtract
            JSON_CONTAINS_PATH: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Mysql\JsonContainsPath

            concat_ws: DoctrineExtensions\Query\Mysql\ConcatWs

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
