php 使用mapping_types参数时Symfony doctrine.yaml出错

xzlaal3s  于 2023-10-15  发布在  PHP
关注(0)|答案(1)|浏览(104)

我正在尝试通过以下这篇文章在Symfony Doctrine和PostgreSQL中实现一个新的Enum自定义类型:
我知道这篇文章针对的是以前的PHP 8.1版本,但我只是喜欢这种方法,我想使用它。
[Article-link] https://wata.es/migration-of-a-project-from-angular-7-to-angular-8-what-are-the-benefits-1-2/
(Yes URL错误)
我按照所有的指令写在那里,我继续得到以下错误,每次我试图运行任何bin/console命令:
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.*"
    }
}

告诉我如果你需要其他信息。
提前感谢您的帮助。

qjp7pelc

qjp7pelc1#

我已经解决了这个问题做一个完整的 composer 重新安装Symfony
代码现在可以工作了,可能是Symfony运行时在开发过程中崩溃了。
如果经过一些调试后,您发现任何bin\console命令都不起作用,请执行相同的操作。

相关问题