views:

56

answers:

1

Hi everybody,

  1. I have created a function in the bootstrap to do the routing.
  2. Once a route has been selected I would like to know which one it is.

Ideally I would like to be able to get that information in the bootstrap too, let's say I have a 1st function _initRouting() which decides of the routing and then later in the bootstrap a 2nd function _whichRoute() which would tell me which route was selected.

Thanks.

+2  A: 

From docs:

If you need to determine which route was matched, you can use the getCurrentRouteName() method, which will return the identifier used when registering the route with the router. If you want the actual route object, you can use getCurrentRoute().

So in your bootstrap you will probably need to get the request object and use the above or use a controller plugin

Ashley
beat me to it by 1 second :)
Gordon
Winnneerrrrrrrrr
Ashley
I'm afraid I have to remove the accept. It looks like the route isn't selected until we leave the bootstrap. If I call getCurrentRoute() at the end of my boostrap I get a "Current route is not defined" exception. The question was about getting "that information in the bootstrap too". Any idea?