phly / PhlyRestfully

ZF2 module for creating RESTful JSON APIs using HAL and API-Problem
108 stars 45 forks source link

[WIP] Passing event parameters #35 #38

Closed macnibblet closed 11 years ago

macnibblet commented 11 years ago

Example usage of this would be

$controller = new RestResourceController();
$controller->getEventManager()->attach('getList.pre', function(Event $e) {

    /**
     * @var $target \PhlyRestfully\ResourceController
     */
    $target  = $e->getTarget();
    $request = $target->getRequest();

    $resource = $target->getResource();
    $resource->setEventParams(array(
        'range'   => $request->getQuery('range', false)
    ));
});