Reputation: 31
my routing code:
F3::route('GET @root: /', "\\Controller\\_App\\App_navigation->get_delegator");
F3::route('GET @modul: /@module', "\\Controller\\@module->get_index");
F3::route('POST @modul', "\\Controller\\@module->post_index");
F3::route('GET @proses: /@module/@proc.ksd', "\\Controller\\@module->get_@proc");
F3::route('POST @proses', "\\Controller\\@module->post_@proc");
F3::route('GET @submodul: /@module/@submodule', "\\Controller\\@module\\@submodule->get_index");
F3::route('POST @submodul', "\\Controller\\@module\\@submodule->post_index");
F3::route('GET @proses2: /@module/@submodule/@proc.ksd', "\\Controller\\@module\\@submodule->get_@proc");
F3::route('POST @proses2', "\\Controller\\@module\\@submodule->post_@proc");
i was trying to access the proses
route, and it's didn't match any. is this a unexpected behavior?
it's working when i disable the submodul
and proses2
routing name.
how to resolve this?
Upvotes: 0
Views: 143
Reputation: 3908
Actually, you've hit a bug: /@module/@submodule
took precedence order over /@module/@proc.ksd
while it shouldn't.
If you download the latest base.php
from the edge repository, your issue should be fixed.
Upvotes: 2
Reputation: 631
There is xfra35 answer which hopefully will fix your issue.
However in my opinion it is always going to be tricky when you have one route (in your example /@module/@submodule
) which is more general than the other (/@module/@proc.ksd
). In theory the engine should know that the latter is more strict than the former. Or that the former was declared later so it should be matched as the last one if other rules failed to match. But it may not always be the case.
If I were in your shoes, I would feel safer with some other solution. For example I would try to merge @proses
and @proses2
rules by putting all actions that are currently handled by main modules into dedicated submodules. So each module would only have a get_index
method, while all other get_*
methods would be in submodules. What do you think about this idea?
Upvotes: 0