Development

#3121 (YAML documentation regarding arrays)

You must first sign up to be able to contribute.

Ticket #3121 (closed documentation: fixed)

Opened 9 months ago

Last modified 5 months ago

YAML documentation regarding arrays

Reported by: corporealfunk Assigned to: FabianLange
Priority: minor Milestone: 1.1.0
Component: configuration Version: 1.1.0 DEV
Keywords: YAML arrays Cc:
Qualification: Ready for core team

Description

The documentation omits an important fact about how symfony parses YAML arrays.

In an app.yml file, if you have:

all:
  servers: { host1: 9834, host2: 348 }

sfConfig::getAll() contains keys for:

  • app_servers_host1
  • app_servers_host2

but does not contain a key for:

  • app_servers

which is expected to contain (based on the Spyc library, (which is parsing correctly based on my investigation)) an array such as:

array("host1" => "9834", "host2" => "348");

This fact is not documented. Nor is the workaround, which is that you must place any YAML array definition "2 levels" deep in your YAML, like so:

all:
  general:
    servers: { host1: 9834, host2: 348 }

now there is a key for "app_general_servers" and it's value is an array which is expected.

Change History

04/08/08 20:39:46 changed by dwhittle

  • version changed from 1.0.11 to 1.1.0 DEV.
  • qualification changed from Unreviewed to Design decision.

06/23/08 06:40:28 changed by dwhittle

  • qualification changed from Design decision to Ready for core team.
  • milestone set to 1.1.0.

06/27/08 10:33:55 changed by FabianLange

for me it reads like a bug that causes 1 level versions not to work

06/27/08 10:47:09 changed by FabianLange

The code says that the first level is always the category, which is appended to app_

    foreach ($config as $category => $keys)

Ill crosscheck if that was different on 1.0 and why this could have changed

06/27/08 10:49:51 changed by FabianLange

  • owner changed from fabien to FabianLange.
  • status changed from new to assigned.

yep, has been the same as for symfony 1.0. Ill see how we can update the documentation to make this clearer

06/27/08 11:28:07 changed by FabianLange

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [9917]) doc: added example on how to realize first level arrays in symfony configuration files. closes #3121