Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ContentAwareGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Symfony\Cmf\Component\Routing;

use Doctrine\Common\Collections\Collection;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is ok to use and to check instanceof a not existing class so this adds no new dependency.

use Symfony\Component\Routing\Route as SymfonyRoute;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\RouteCollection;
Expand Down Expand Up @@ -181,7 +182,11 @@ protected function getRouteByContent($name, &$parameters)
return $route;
}

// if none matched, continue and randomly return the first one
// if none matched, randomly return the first one
if ($routes instanceof Collection) {
return $routes->first();
}

return reset($routes);
}

Expand Down