Skip to content

Commit

Permalink
Merge pull request #83 from symfony-cmf/handle-doctrine-collections
Browse files Browse the repository at this point in the history
with doctrine, the routes are probably a Collection. reset() on a collection does not work
  • Loading branch information
lsmith77 committed Sep 27, 2013
2 parents 3e722db + 7432c29 commit 2a5cc82
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 2a5cc82

Please sign in to comment.