Welcome Guest, Not a member yet? Register   Sign In
Bug? Vendor Routes are loaded before Filters
#1

I have an issue where i am trying to set up a route filter in vendor/myname/packagename
Autoloader works fine everything gets discovered but i get

Code:
my-auth filter must have a matching alias defined.

My src/Config/Filters.php

PHP Code:
<?php
namespace MyName\PackageName\Config;

$filters->aliases['my-auth'] = \MyName\PackageName\Filters\Auth::class;

die(
'Filters found!'); // This fires well when i remove routes definition 

My src/Config/Routes.php

PHP Code:
<?php

namespace MyName\PackageName\Config;

$routes->group('area', ['filter' => 'my-auth''namespace' => '\MyName\PackageName\Controllers'], function ($routes) {
    $routes->get('method1''MyController::method1');
    $routes->get('method2''MyController::method2');
}); 

Application app/Config/Modules.php is untouched:

PHP Code:
public $aliases = [
    'events',
    'filters',
    'registrars',
    'routes',
    'services',
]; 

When i remove ['filter' => 'my-auth'] from routes, all works (w/o filtering) and by cleaning src/Config/Routes.php file contents i can play around with $filters in src/Config/Filters.php - they both get discovered and work individualy.

I also stubled on $customfilters in codeigniter system/Filters/Filters.php:116 tried using it everywhere but no effect, googling it also yelded little to no result.

Is my issue a legit one or am i doing something very wrong?
Reply


Messages In This Thread
Bug? Vendor Routes are loaded before Filters - by stopz - 05-21-2021, 07:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB