Symfony\Component\Routing\RouteCollection::count PHP Method

count() public method

Gets the number of Routes in this collection.
public count ( ) : integer
return integer The number of routes in this collection, including nested collections
    public function count()
    {
        $count = 0;
        foreach ($this->routes as $route) {
            $count += $route instanceof RouteCollection ? count($route) : 1;
        }

        return $count;
    }

Usage Example

 protected function loadRoutes()
 {
     $this->routes->add('dynamic_route_' . ($this->routes->count() + 1), new Route('pup/image/upload/service', $defaults = array('_controller' => 'pupBundle:Process:upload'), $requirements = array()));
     //add another
     //or execute a db query and add multiple routes
     //etc.
 }
All Usage Examples Of Symfony\Component\Routing\RouteCollection::count