sfMergeKey.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --- %YAML:1.0
  2. test: Simple In Place Substitution
  3. brief: >
  4. If you want to reuse an entire alias, only overwriting what is different
  5. you can use a << in place substitution. This is not part of the official
  6. YAML spec, but a widely implemented extension. See the following URL for
  7. details: http://yaml.org/type/merge.html
  8. yaml: |
  9. foo: &foo
  10. a: Steve
  11. b: Clark
  12. c: Brian
  13. e: notnull
  14. bar:
  15. a: before
  16. d: other
  17. e: ~
  18. <<: *foo
  19. b: new
  20. x: Oren
  21. c:
  22. foo: bar
  23. bar: foo
  24. bar_inline: {a: before, d: other, <<: *foo, b: new, x: Oren, c: { foo: bar, bar: foo}}
  25. foo2: &foo2
  26. a: Ballmer
  27. ding: &dong [ fi, fei, fo, fam]
  28. check:
  29. <<:
  30. - *foo
  31. - *dong
  32. isit: tested
  33. head:
  34. <<: [ *foo , *dong , *foo2 ]
  35. taz: &taz
  36. a: Steve
  37. w:
  38. p: 1234
  39. nested:
  40. <<: *taz
  41. d: Doug
  42. w: &nestedref
  43. p: 12345
  44. z:
  45. <<: *nestedref
  46. head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] }
  47. recursive_inline: { <<: *head_inline, c: { <<: *foo2 } }
  48. php: |
  49. [
  50. 'foo' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'],
  51. 'bar' => ['a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'x' => 'Oren'],
  52. 'bar_inline' => ['a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'e' => 'notnull', 'x' => 'Oren'],
  53. 'foo2' => ['a' => 'Ballmer'],
  54. 'ding' => ['fi', 'fei', 'fo', 'fam'],
  55. 'check' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'],
  56. 'head' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
  57. 'taz' => ['a' => 'Steve', 'w' => ['p' => 1234]],
  58. 'nested' => ['a' => 'Steve', 'w' => ['p' => 12345], 'd' => 'Doug', 'z' => ['p' => 12345]],
  59. 'head_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
  60. 'recursive_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => ['a' => 'Ballmer'], 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
  61. ]