When using route('myalias') it will throw an exception Route [myalias] not defined..
Expected Behaviour
Obviously it should not throw an exception
Steps to Reproduce
See actual behavior.
Possible Solutions
After a quick check I've realised that RouteCollection->add() does the name list lookup. The problem is that ->name() is added afterwards to the route, so the route collection is not build up correctly. Refreshing the RouteCollection seems to fix the behavior.
Additional note
It will still fail when we have an exception before the Adapter->dispatch() is hit and we'll use route() during exception handling. Didn't found a better solution for now but it gives us an additional feature for now w/o breaking existing functionality.
Actual Behaviour
Given the following route definition:
When using
route('myalias')
it will throw an exceptionRoute [myalias] not defined.
.Expected Behaviour
Obviously it should not throw an exception
Steps to Reproduce
See actual behavior.
Possible Solutions
After a quick check I've realised that RouteCollection->add() does the name list lookup. The problem is that
->name()
is added afterwards to the route, so the route collection is not build up correctly. Refreshing the RouteCollection seems to fix the behavior.Additional note
It will still fail when we have an exception before the Adapter->dispatch() is hit and we'll use route() during exception handling. Didn't found a better solution for now but it gives us an additional feature for now w/o breaking existing functionality.