Skip to content

Commit

Permalink
Fixed #9020 - Added support for collections in service#parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lavoiesl authored and fabpot committed Dec 30, 2013
1 parent c92274a commit a2358e0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 2 deletions.
Expand Up @@ -121,10 +121,12 @@

<xsd:complexType name="property" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="service" type="service" />
</xsd:choice>
<xsd:attribute name="type" type="argument_type" />
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="key" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="on-invalid" type="xsd:string" />
<xsd:attribute name="strict" type="boolean" />
Expand Down
Expand Up @@ -15,7 +15,7 @@
setFactoryClass('FooClass')->
setFactoryMethod('getInstance')->
setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, new Reference('service_container')))->
setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz')))->
setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%')))->
addMethodCall('setBar', array(new Reference('bar')))->
addMethodCall('initialize')->
setConfigurator('sc_configure')
Expand Down
Expand Up @@ -123,6 +123,7 @@ protected function getFooService()
$instance->initialize();
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo'));
sc_configure($instance);

return $instance;
Expand Down
Expand Up @@ -131,6 +131,7 @@ protected function getFooService()
$instance->initialize();
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar');
sc_configure($instance);

return $instance;
Expand Down
Expand Up @@ -19,6 +19,10 @@
<argument type="service" id="service_container"/>
<property name="foo">bar</property>
<property name="moo" type="service" id="foo.baz"/>
<property name="qux" type="collection">
<property key="%foo%">foo is %foo%</property>
<property key="foobar">%foo%</property>
</property>
<call method="setBar">
<argument type="service" id="bar"/>
</call>
Expand Down
Expand Up @@ -12,7 +12,7 @@ services:
factory_class: FooClass
factory_method: getInstance
arguments: [foo, '@foo.baz', { '%foo%': 'foo is %foo%', foobar: '%foo%' }, true, '@service_container']
properties: { foo: bar, moo: '@foo.baz' }
properties: { foo: bar, moo: '@foo.baz', qux: { '%foo%': 'foo is %foo%', foobar: '%foo%' } }
calls:
- [setBar, ['@bar']]
- [initialize, { }]
Expand Down

0 comments on commit a2358e0

Please sign in to comment.