Right now, the order in which you specify the arguments in the service
definition is meaningful, and they will be mapped to the constructor
in the same order. Let's say, you have

<service id="foo">
    <argument>a</argument>
    <argument>b</argument>
</service>

Then the constructor will look similar to this "new Foo('a', 'b');".

For definitions which inherit from other definitions, it is also
possible to specify the index of an argument like this

<service parent="foo" id="bar">
    <argument index="0">c</argument>
</service>

The constructor would then receive "new Foo('c', 'b');".

I'd like to make the argument element a bit more consistent, powerful
and intelligent. Let's say you have the following class:

class Foo
{
    public function __construct($a, $b, Bar $c) { }
}

1. Argument mapping based on parameter name
<argument name="a">a</argument>

2. Argument mapping based on parameter index (0-based)
<argument index="1">b</argument>

3. Argument mapping based on type inference (this argument would be
mapped to $c if the service "bar" is an instance of Bar)
<argument type="service" id="bar" />


Since this would mean a major BC break (many <argument> tags which
cannot be determined based on type inference would need to be
updated), I'd like to hear your opinion.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to