使用mapping_types参数时Symfonydoctrine.yaml中出现错误

问题描述 投票:0回答:1

我正在尝试按照本文在 Symfony Doctrine 和 PostgreSQL 中实现新的 Enum 自定义类型:

我知道这篇文章针对的是以前的 PHP 8.1 版本,但我只是喜欢这种方法,并且我想使用它。

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

(是的,网址错误)

我遵循了那里写的所有说明,每次尝试运行任何 bin/控制台命令时,我都会继续收到以下错误:

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

问题似乎出在我的doctrine.yaml 文件中:

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

这是我的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.*"
    }
}

如果您需要其他信息,请告诉我。

预先感谢您的帮助。

php postgresql symfony doctrine doctrine-dbal
1个回答
0
投票

我通过完全重新安装 Symfony 作曲家解决了这个问题

代码现在可以运行,可能 Symfony 运行时在开发过程中损坏了。

© www.soinside.com 2019 - 2024. All rights reserved.