Fehler „Doppelpunkt kann nicht in zugeordneten Werten ohne Anführungszeichen verwendet werden' in „services.yml'.
P粉448130258
P粉448130258 2024-03-29 10:32:35
0
1
337

Ich komme hierher, um meine Frage zu stellen, weil ich wirklich nicht weiß, was ich tun soll, und weil ich im Internet nicht die richtigen Informationen finden kann. Ich suche nach Service-Bindungsparametern für die Kommunikation mit der BigQuery API (GCP). Dazu habe ich die Parameter aus „parameters.yml“ übergeben und die Parameter in „services.yml“ gebunden. Wenn ich die Seite neu lade, erhalte ich die Fehlermeldung: „Datei /home/docker/symfony/src/xxx/DependencyInjection/../Resources/config/services.yml“ enthält kein gültiges YAML: Doppelpunkt kann nicht ohne Anführungszeichen verwendet werden der zugeordnete Wert aus Zeile 84 unten (in der Nähe von „$bucketName:%google_bucket_name%“).

Wissen Sie, was die Ursache des Problems ist?

Bitte suchen Sie im Anhang nach den relevanten Teilen der Dateien „services.yml“ und „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: Der Code scheint ein Problem mit den Parametern von ImportLicenceCodeService zu haben

Vielen Dank im Voraus für eure Hilfe ;)

P粉448130258
P粉448130258

Antworte allen(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%"
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!