search

Home  >  Q&A  >  body text

"Colon cannot be used in unquoted mapped values" error in services.yml

I come here to ask my question because I really don't know what to do and I can't find the right information on the internet. I'm looking for service binding parameters for communicating with the BigQuery API (GCP). To do this, I passed the parameters from "parameters.yml" and bound the parameters in "services.yml". When I reload the page, I get the error: "File /home/docker/symfony/src/xxx/DependencyInjection/../Resources/config/services.yml" does not contain valid YAML: colon cannot be used without quotes Use the mapped value from line 84 below (near "$bucketName:%google_bucket_name%").

Do you know what the source of the problem is?

Please find the relevant parts of the "services.yml" and "parameters.yml" files in the attachment

-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: The code seems to have a problem with the parameters of ImportLicenceCodeService

Thanks in advance for your help;)

P粉448130258P粉448130258246 days ago386

reply all(1)I'll reply

  • P粉895187266

    P粉8951872662024-03-30 00:35:04

    As @bossman already pointed out, the answer is intention.

    I just wanted to add that you can get rid of a lot of unnecessary duplicate content. When you write like this:

    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%"

    reply
    0
  • Cancelreply