philiplb / CRUDlex

CRUDlex is an easy to use CRUD generator for Symfony 4 and Silex 2 which is great for auto generated admin pages
https://philiplb.de/crudlex/
MIT License
109 stars 23 forks source link

Is it possible to chain middleware ? #88

Closed planeth44 closed 7 years ago

planeth44 commented 7 years ago

As described in Silex documentation, there's a finish middleware that can execute tasks after the Response has been sent to the client. How could we do it for a particular route? Say for example: /crud/myTable/update/xxx

philiplb commented 7 years ago

Hi, sry for the late answer. :) You can add middlewares to routes after mounting like this:

$app->flush();
$route = $app['routes']->get('crudList');
$route->before(function(Symfony\Component\HttpFoundation\Request $request) use ($app) {
    // ...
});

Existing routes of CRUDlex are:

I will also add this to the documentation as it might be usefull. :) Feel free to reopen if you have any further questions.

philiplb commented 7 years ago

(Static route prefix done: https://github.com/philiplb/CRUDlex/commit/889dbad3ab2dea896492a67cbcd59f07049a85b9)

philiplb commented 7 years ago

I added some documentation about it: http://philiplb.github.io/CRUDlex/docs/html/0.12.0/manual/routes.html

planeth44 commented 7 years ago

Thanks a lot