CodeIgniter Forums
Filter arguments - howto? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Filter arguments - howto? (/showthread.php?tid=76927)



Filter arguments - howto? - tgix - 07-04-2020

Creating my RESTful API and I'd like to use the filter arguments as described in the docs:
http://codeigniter.com/user_guide/incoming/routing.html#applying-filters

However, the FilterInterface signatures for after() and before() doesn't allow me to access the arguments passed (even though they are passed from \CodeIgniter\Filters::run). As I cannot create my own implementations of after() and before() that includes the argument without breaking \CodeIgniter\Filters\FilterInterface I'm at a loss here.

Realizing that a patch for this would break all code implementing \CodeIgniter\Filters\FilterInterface I don't find that to be a good solution, but still I'm working on a patch.

Or, maybe I am missing something completely?


RE: Filter arguments - howto? - mynameiskelvin - 07-13-2020

Saw someone made a fix here, maybe its you?
https://github.com/codeigniter4/CodeIgniter4/pull/3217

Maybe someone can help and check if this is the right solution? Or other alternatives there?


RE: Filter arguments - howto? - tgix - 07-15-2020

Yup, that PR is mine. Since that adds a new interface instead of fixing the actual bug, the jury is still out how to fix the issue. Seems like 4.0.4 will be released without a fix.