evan108108 / RESTFullYii

RESTFull API for your Yii application

Home Page:http://evan108108.github.com/RESTFullYii/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request: ability to pass callable to onRest

bkdotcom opened this issue · comments

I realize this library is ancient and not receiving updates, but...

this would be awesome:

$this->onRest(ERestEvent::REQ_AUTH_AJAX_USER, array($handler, 'method'));

It doesn't fail until Eventor::emit() attempts to
$callback = $listener['callback']->bindTo( $this->getBoundObj() );
on the callable array

should only perform the bindTo when $listener['callback'] instanceof Closure

as is, I've ended up with a lot of cruft:

$this->controller->onRest(ERestEvent::REQ_AUTH_AJAX_USER, function () use ($handler) {
    return call_user_func_array(array($handler, method'), func_get_args());
});

Sounds like a great feature please add it and submit a pull request.