services.yml 中出现'冒号不能在未加引号的映射值中使用”错误
P粉448130258
P粉448130258 2024-03-29 10:32:35
0
1
339

我来这里问我的问题是因为我真的不知道该怎么办,而且我在互联网上找不到正确的信息。 我正在寻找用于与 BigQuery API (GCP) 通信的服务绑定参数。为此,我传递了“parameters.yml”中的参数,并将参数绑定在“services.yml”中。当我重新加载页面时,出现错误:“文件 /home/docker/symfony/src/xxx/DependencyInjection/../Resources/config/services.yml”不包含有效的 YAML:冒号不能在不带引号的情况下使用第 84 行的映射值(“$bucketName:%google_bucket_name%”附近)。

您知道问题的根源是什么吗?

请查找附件中的“services.yml”和“parameters.yml”文件的相关部分

-services.yml

  AdminBundle\Services\CustomerChangeSetService:
    public: true
    autowire: true
    autoconfigure: true
    bind:
      $googleProjectId: "%google_project_id%"
      $googlePath: "%kernel.root_dir%/../%google_token_path%"
      $googleQuery: "%google_bigquery_dataset%"
      $googleConfig: "%config_bigQuery_prod%"
      $tableName: "%google_bigquery_table_customerchangeset%"
      $bucketName: "%google_bucket_name%"

  AdminBundle\Services\APILogsService:
    public: true
    autowire: true
    autoconfigure: true
    bind:
      $googleProjectId: "%google_project_id%"
      $googlePath: "%kernel.root_dir%/../%google_token_path%"
      $googleQuery: "%google_bigquery_dataset%"
      $googleConfig: "%config_bigQuery_prod%"
      $tableName: "%google_bigquery_table_apilogs%"
      $bucketName: "%google_bucket_name%"

  AdminBundle\Services\ImportLicenceCodeService:
    public: true
      autowire: true
      autoconfigure: true
      bind:
        $googleProjectId: "%google_project_id%"
        $googlePath: "%kernel.root_dir%/../%google_token_path%"
        $googleQuery: "%google_bigquery_dataset%"
        $googleConfig: "%config_bigQuery_prod%"
        $tableName: "%google_bigquery_table_importlicencecode%"
        $bucketName: "%google_bucket_name%"

-parameters.yml

    google_token_path: ./google_token.json
    google_project_id: "xxx"
    google_bigquery_dataset: "xxx"
    google_bigquery_table_accessmember: "xxx"
    google_bigquery_table_customerchangeset: "xxx"
    google_bigquery_table_apilogs: "xxx"
    google_bigquery_table_importlicencecode: "xxx"
    google_bucket_name: "xxx"

PS:代码好像是ImportLicenceCodeService的参数有问题

预先感谢您的帮助;)

P粉448130258
P粉448130258

全部回复(1)
P粉895187266

正如@bossman 已经指出的那样,答案是意图。

我只是想补充一点,你可以去掉很多不需要的重复内容。当你这样写时:

services:
    _defaults:
        autowire: true
        autoconfigure: true
        bind:
            $googleProjectId: "%google_project_id%"
            $googlePath: "%kernel.root_dir%/../%google_token_path%"
            $googleQuery: "%google_bigquery_dataset%"
            $googleConfig: "%config_bigQuery_prod%"            
            $bucketName: "%google_bucket_name%"

  AdminBundle\Services\CustomerChangeSetService:
    public: true
    bind:
        $tableName: "%google_bigquery_table_customerchangeset%"


  AdminBundle\Services\APILogsService:
    public: true
    bind:
        $tableName: "%google_bigquery_table_apilogs%"


  AdminBundle\Services\ImportLicenceCodeService:
    public: true
    bind:
        $tableName: "%google_bigquery_table_importlicencecode%"
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!