public function getPages()
    {
        $pages = array();

        foreach ($this->router->getRouteCollection()->all() as $route) {
            if ($method = $this->getReflectionMethod($route->getDefault('_controller'))) {
                if ($composerAnnotation = $this->reader->getMethodAnnotation($method, self::COMPOSER_ANNOTATION_CLASS)) {
                    if ($composerAnnotation !== null) {
                        // setup a fresh page object
                        $page = new Page();
                        $page->setName($composerAnnotation->getName());

                        // create url from route annotation or from route pattern
                        $routeAnnotation = $this->reader->getMethodAnnotation($method, self::ROUTE_ANNOTATION_CLASS);

                        try {
                            $page->setUrl($this->router->generate($routeAnnotation->getName()));
                        }
                        catch (RouteNotFoundException $e) {
                            $this->container->get('logger')->info('The @Route annotation of '.$route->getDefault('_controller').' has no name. Please specify it for better page linking.');
                            $page->setUrl($this->router->getContext()->getBaseUrl().$route->getPattern());
                        }

                        // add page
                        $pages[] = $page;
                    }
                }
            }
        }

        return $pages;
    }
public function getPages()
    {
        $pages = array();

        foreach ($this->router->getRouteCollection()->all() as $route) {
            if ($method = $this->getReflectionMethod($route->getDefault('_controller'))) {
                if ($composerAnnotation = $this->reader->getMethodAnnotation($method, self::COMPOSER_ANNOTATION_CLASS)) {
                    if ($composerAnnotation !== null) {
                        // setup a fresh page object
                        $page = new Page();
                        $page->setName($composerAnnotation->getName());

                        // create url from route annotation or from route pattern
                        $routeAnnotation = $this->reader->getMethodAnnotation($method, self::ROUTE_ANNOTATION_CLASS);

                        try {
                            $page->setUrl($this->router->generate($routeAnnotation->getName()));
                        }
                        catch (RouteNotFoundException $e) {
                            $this->container->get('logger')->info('The @Route annotation of '.$route->getDefault('_controller').' has no name. Please specify it for better page linking.');
                            $page->setUrl($this->router->getContext()->getBaseUrl().$route->getPattern());
                        }

                        // add page
                        $pages[] = $page;
                    }
                }
            }
        }

        return $pages;
    }
public function getPages ( ) { $ pages = array ( ) ; foreach ( $ this -> router -> getRouteCollection ( ) -> all ( ) as $ route ) { if ( $ method = $ this -> getReflectionMethod ( $ route -> getDefault ( '_controller' ) ) ) { if ( $ composerAnnotation = $ this -> reader -> getMethodAnnotation ( $ method , self :: COMPOSER_ANNOTATION_CLASS ) ) { if ( $ composerAnnotation !== null ) { // setup a fresh page object $ page = new Page ( ) ; $ page -> setName ( $ composerAnnotation -> getName ( ) ) ; // create url from route annotation or from route pattern $ routeAnnotation = $ this -> reader -> getMethodAnnotation ( $ method , self :: ROUTE_ANNOTATION_CLASS ) ; try { $ page -> setUrl ( $ this -> router -> generate ( $ routeAnnotation -> getName ( ) ) ) ; } catch ( RouteNotFoundException $ e ) { $ this -> container -> get ( 'logger' ) -> info ( 'The @Route annotation of ' . $ route -> getDefault ( '_controller' ) . ' has no name. Please specify it for better page linking.' ) ; $ page -> setUrl ( $ this -> router -> getContext ( ) -> getBaseUrl ( ) . $ route -> getPattern ( ) ) ; } // add page $ pages [ ] = $ page ; } } } } return $ pages ; }
Gets all existing Pages

@return array All existing Page instances
Gets all existing Pages