Error in Symfony doctrine.yaml when using mapping_types parameter

304 views Asked by At

I'm trying to implement a new Enum custom type in Symfony Doctrine and PostgreSQL by following this article:

I know that the article aims to previous PHP 8.1 versions but I simply like that approach and I would like to use it.

[Article-link]https://wata.es/migration-of-a-project-from-angular-7-to-angular-8-what-are-the-benefits-1-2/)

(Yes, url is wrong)

I followed all the instruction written there and I continue to get the following error everytime i try to run any bin/console command:

You have requested a non-existent parameter "doctrine.". Did you mean one of these: "doctrine.dbal.configuration.class", "doctrine.data_collector.class", "doc trine.dbal.connection.event_manager.class", ecc ecc

It seems like problem resides in my doctrine.yaml file:

doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'

        # [MANDATORY] Everytime a custom type is created in PostgresSQL it must be added here

        mapping_types: 
          conn_enum_type: conn_enum_type

        profiling_collect_backtrace: '%kernel.debug%'
 
        types: 
          conn_enum_type: App\Doctrine\DBAL\AutoLogConnectionType
    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
        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

This is a part of my composer.json:

"php": ">=8.1",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/doctrine-bundle": "^2.10",
        "doctrine/doctrine-migrations-bundle": "^3.2",
        "doctrine/orm": "^2.16",
        "drush/drush": "^12.2",
        "paragonie/sodium_compat": "^1.20",
        "phpdocumentor/reflection-docblock": "^5.3",
        "phpstan/phpdoc-parser": "^1.24",
        "symfony/asset": "6.3.*",
        "symfony/console": "6.3.*",
        "symfony/doctrine-messenger": "6.3.*",
        "symfony/dotenv": "6.3.*",
        "symfony/expression-language": "6.3.*",
        "symfony/flex": "^2",
        "symfony/form": "6.3.*",
        "symfony/framework-bundle": "6.3.*",
        "symfony/http-client": "6.3.*",
        "symfony/intl": "6.3.*",
        "symfony/mailer": "6.3.*",
        "symfony/mime": "6.3.*",
        "symfony/monolog-bundle": "^3.0",
        "symfony/notifier": "6.3.*",
        "symfony/process": "6.3.*",
        "symfony/property-access": "6.3.*",
        "symfony/property-info": "6.3.*",
        "symfony/runtime": "6.3.*",
        "symfony/security-bundle": "6.3.*",
        "symfony/serializer": "6.3.*",
        "symfony/string": "6.3.*",
        "symfony/translation": "6.3.*",
        "symfony/twig-bundle": "6.3.*",
        "symfony/validator": "6.3.*",
        "symfony/web-link": "6.3.*",
        "symfony/yaml": "6.3.*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"

"require-dev": {
        "phpunit/phpunit": "^9.5",
        "symfony/browser-kit": "6.3.*",
        "symfony/css-selector": "6.3.*",
        "symfony/debug-bundle": "6.3.*",
        "symfony/maker-bundle": "^1.51",
        "symfony/phpunit-bridge": "^6.3",
        "symfony/stopwatch": "6.3.*",
        "symfony/web-profiler-bundle": "6.3.*"
    }
}

Tell me if you need other informations.

Thank you in advance for your help.

1

There are 1 answers

0
ANPropagate On

I've solved the problem by doing a complete composer reinstall of Symfony

Code works now, probably Symfony runtime broke during development.

Do the same if after some debugging you see that any of your bin\console commands don't work.