【发布时间】:2016-08-08 06:53:27
【问题描述】:
我有一些看起来像这样的服务定义:
MyService:
class: Some\Class\Here
factory:
- SomeFactoryHere
- method
calls:
- [add, ["@=service('AnotherService1').create(service('AnotherService2'), service('AnotherService3'), service('AnotherService3'))"]]
恕我直言,如果转换成这样的内容会更易读:
MyService:
class: Some\Class\Here
factory:
- SomeFactoryHere
- method
calls:
-
add,
"@=service('AnotherService1').create(
service('AnotherService2'),
service('AnotherService3'),
service('AnotherService3')
)"
但是,这不是有效的 YAML(Symfony 解析器失败),我的问题是如何将这个配置转换为上面的内容?
UPD#1
看看Symfony YAML format conversion: "calls" with string params - 重要的细微差别在那里。
【问题讨论】:
标签: php symfony format yaml config