Hi all,
There are times when you need some custom routing for your development.
I'm tired of doing it over and over again for each component, so i'm starting the journey of trying to abstract it in a dedicated component.
Basically, i'm aware of 2 methods to achieve this :
1 - doing it the "Discuss way" (some rewrite rules, controllers & a "router" resource)
2 - using some "placeholder" resource to sendForward() to when OnPageNotFound event is triggered
I was just wondering what method you guys are using, as well as what are your usual needs in custom routing ? (ie. the kind of constraints to satisfy before allowing the route to be processed).
For the record, here a route configuration array, hoping that might talk to you guys
<?php
return array(
// The context the routes are allowed in
'web' => array(
// The request method
'GET' => array(
// The route pattern {ObjectClass:column}, object class being also used as parameter name, column being optional (defaulting to alias)
'/pro/{Professional:alias}' => array(
// Optional service class to load
'service' => 'Professionals',
// Some constraints to make sure are satisfied before routing
'constraints' => array(
// Parameter name (object class name) => array of constraints
'Professional' => array(
'published' => true,
),
),
// Optional Route derivated class to instanciate
'class' => 'ProRouter',
// Optional class path
'class_path' => dirname(__FILE__) . '/routes/',
),
),
),
);
I definitely would love to get your feedbacks & ideas

Thanks