@@ -201,6 +201,12 @@ public function generate($name, $parameters = array(), $absolute = false)
201
201
{
202
202
$ debug = array ();
203
203
204
+ if (is_object ($ name )) {
205
+ $ displayName = get_class ($ name );
206
+ } else {
207
+ $ displayName = $ name ;
208
+ }
209
+
204
210
foreach ($ this ->all () as $ router ) {
205
211
// if $router does not implement ChainedRouterInterface and $name is not a string, continue
206
212
if ($ name && !$ router instanceof ChainedRouterInterface) {
@@ -219,7 +225,7 @@ public function generate($name, $parameters = array(), $absolute = false)
219
225
} catch (RouteNotFoundException $ e ) {
220
226
$ hint = ($ router instanceof VersatileGeneratorInterface)
221
227
? $ router ->getRouteDebugMessage ($ name , $ parameters )
222
- : "Route ' $ name ' not found " ;
228
+ : "Route ' $ displayName ' not found " ;
223
229
$ debug [] = $ hint ;
224
230
if ($ this ->logger ) {
225
231
$ this ->logger ->info ('Router ' .get_class ($ router )." was unable to generate route. Reason: ' $ hint': " .$ e ->getMessage ());
@@ -231,7 +237,7 @@ public function generate($name, $parameters = array(), $absolute = false)
231
237
$ debug = array_unique ($ debug );
232
238
$ info = implode (', ' , $ debug );
233
239
} else {
234
- $ info = "No route ' $ name ' found " ;
240
+ $ info = "No route ' $ displayName ' found " ;
235
241
}
236
242
237
243
throw new RouteNotFoundException (sprintf ('None of the chained routers were able to generate route: %s ' , $ info ));
0 commit comments