PHP-DI / Silex-Bridge

PHP-DI integration in Silex
http://php-di.org/doc/frameworks/silex.html
MIT License
24 stars 8 forks source link

Override CallbackResolver #9

Closed praswicaksono closed 8 years ago

praswicaksono commented 8 years ago

currently in 1.3 CallbackResolver class only process valid callable and formatted service name servicename:method. Since mostly I use class name as service ID it feel weird if I pass callable service name. For example

$app->get('/{name}', HelloName::class)
    ->convert('req', HelloNameConverter::class . ':__invoke');

i have to append with ':invoke' each callback. I proposed to override CallbackResolver so it can pass any callable service name without append ':invoke'

mnapoli commented 8 years ago

Hi, this is a very good idea.

The Silex\CallbackResolver class could be overridden with an implementation that could call Invoker\CallableResolver::resolve() to resolve the callable.

We might need to keep support of the official notation though (service:method) so that users are not confused…

Feel free to submit a pull request.

mnapoli commented 8 years ago

Documentation added in f53a57173a8b085d99f4feeae4dff474e6d2b18e and I've released 1.4.0. Thanks again!