Skip to content

Commit

Permalink
with doctrine, the routes are probably a Collection. reset() on a col…
Browse files Browse the repository at this point in the history
…lection does not work
  • Loading branch information
dbu committed Sep 27, 2013
1 parent 3e722db commit 7432c29
Showing 1 changed file with 6 additions and 1 deletion.
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;
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

0 comments on commit 7432c29

Please sign in to comment.