Rumah  >  Soal Jawab  >  teks badan

Ralat "Kolon tidak boleh digunakan dalam nilai dipetakan tidak disebut" dalam services.yml

Saya datang ke sini untuk bertanya soalan saya kerana saya benar-benar tidak tahu apa yang perlu dilakukan dan saya tidak dapat mencari maklumat yang betul di internet. Saya sedang mencari parameter mengikat perkhidmatan untuk berkomunikasi dengan API BigQuery (GCP). Untuk melakukan ini, saya lulus parameter daripada "parameters.yml" dan mengikat parameter dalam "services.yml". Apabila saya memuat semula halaman, saya mendapat ralat: "Fail /home/docker/symfony/src/xxx/DependencyInjection/../Resources/config/services.yml" tidak mengandungi YAML yang sah: kolon tidak boleh digunakan tanpa petikan Gunakan nilai yang dipetakan daripada baris 84 di bawah (berhampiran "$bucketName:%google_bucket_name%").

Tahukah anda apa punca masalah?

Sila cari bahagian berkaitan fail "services.yml" dan "parameters.yml" dalam lampiran

-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: Kod nampaknya mempunyai masalah dengan parameter ImportLicenceCodeService

Terima kasih terlebih dahulu atas bantuan anda ;)

P粉448130258P粉448130258178 hari yang lalu336

membalas semua(1)saya akan balas

  • P粉895187266

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

    Seperti yang telah @bossman nyatakan, jawapannya adalah niat.

    Saya cuma ingin menambah bahawa anda boleh menyingkirkan banyak kandungan pendua yang tidak perlu. Apabila anda menulis seperti ini:

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

    balas
    0
  • Batalbalas