php - Phalcon ActionFilters -
i'm learning phalcon (trying rest api in multi-module application template), , did simple checking each request, "does request contain specific header" illustration x-api-key (something actionfilters in asp.net mvc).
i tried doing annotations, plugins, beforeexecuteroute, , beforeexception. when write in 1 of them throw new \exception("some exception", 500); phalcon returns blank page without exception message , code. afaik known bug.
i tried dispatcher in beforeexception:
public function beforeexception($event, $dispatcher, $exception) { if ($exception instanceof \phalcon\http\request\exception) { $dispatcher->forward( array( 'controller' => 'error', 'action' => 'showinternalservererror' ) ); homecoming false; } //... } and seems that's working, not elegant solution , i'm lazy :)
question: have improve ideas how actionfilters in phalconphp?
take @ solution on cmoore4/phalcon-rest/httpexception
when application throws httperror 1 modifies response object reflect error details , headers , send output.
i cmoore4 way of doing many things on rest implementation.
php api phalcon phalcon-routing
No comments:
Post a Comment