@diosmosis opened this Issue on October 8th 2014 Member

I've noticed the main use for Request.dispatch is to override existing controller actions, either to return entirely new data or throw an exception in certain cases. The code is usually not very readable and looks pretty fragile. It might be a good idea to create an API for overriding & decorating Piwik routes. Maybe it could look like:

    public function configureRoutes(Router $routes)
    {
        $routes->set("Plugin/whatever?:capture&:otherCapture", array($this, ''newWhatever'))
                ->before("Plugin/something", array($this, 'beforeSomething'))
                ->after("Plugin/something", array($this, 'afterSomething'));
    }

    public function newWhatever($capture, $otherCapture)
    {
        ...
    }

    public function beforeSomething()
    {
        ...
    }
@mattab commented on May 6th 2016 Owner

Maybe this will become easier or more relevant once we will have a REST API refs #6000

This Issue was closed on May 6th 2016
Powered by GitHub Issue Mirror