Hi Kris,

You could add the constructor options as defaults to your resolver and
only resolve with the options passed later.

public function __construct($options) {
    $this->options =
$this->getResolver()->setDefaults($options)->resolve(array());
}

public function filter(.., $options) {
    $options = $this->getResolver()->resolve($options);
}

The second possibility is to extend resolve() to accept a variable
number of arrays.

Cheers,
Bernhard


2012/5/20 Kris Wallsmith <[email protected]>:
> I am looking at using the new OptionsResolver component in Assetic 2.0 for
> configuring filters. I would like to be able to resolve options for each
> filter via the constructor, which the component does very well right now.
> However, I would also like to re-resolve options when the filter is called.
> Something like this…
>
> class SomeFilter
> {
>   private $options;
>
>   public function __construct($options = array())
>   {
>     $this->options = $this->getResolver()->resolve($options);
>   }
>
>   public function filter($asset, $options = array())
>   {
>     $options = $this->getResolver()->extend($this->options, $options);
>
>     // ...
>   }
> }
>
> Is this possible in the current component, or would this be an enhancement?
>
> Thanks,
> Kris
>
> --
> 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

-- 
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