I have an annotation based Action which handles 16 routes. I need to access this action's routes. I can access through router's routeCollection but it brings all system's collections. The count is 413. Is there any elegant way to access only this routes ?
Update : Example code which I can access the routes through route collection. I can move output to cache for further using. But I didn't like the solution.
protected function getRoutes()
{
$searchRoutes = [];
$router = $this->get('router');
$routeCollection = $router->getRouteCollection();
foreach ($routeCollection->all() as $name => $route) {
$route = $route->compile();
if(strpos($name, "newsearch_") !== false) {
$searchRoutes[$name] = $route->getVariables();
}
}
return $searchRoutes;
}