Service definition example I want to convert:
MyService:
class: MyClass
calls:
- [add, ["%param1%", "%param2%"]]
- [add, ["%param3%", "%param4%"]]
And this compile to:
$instance->add('param1', 'param2');
$instance->add('param3', 'param4');
According to my question #38822898 I try next:
MyService:
class: MyClass
calls:
-
- add
-
- "%param1%"
- "%param2%"
- add
-
- "%param3%"
- "%param4%"
And this compile to:
$instance->add('param1', 'param2');
So, where is the problem in second YAML example?
UPD#1
According to my previous question, the next YAML example also do not compile to two calls of "add" method, only one:
MyAnotherService:
class: MyAnotherClass
factory:
- MyFactoryClass
- create
calls:
-
- add
-
- >-
@=service('AnotherService1').create(
service('AnotherService2'),
service('AnotherService3')
)
- add
-
- >-
@=service('AnotherService1').create(
service('AnotherService3'),
service('AnotherService4')
)
Compiles to:
$instance->add($this->get("AnotherService1")->create($this->get("AnotherService2"), $this->get("AnotherService3")));