private function resolvePathToContent(array $item)
    {
        if ($item['path'] === 'homepage') {
            $item['link'] = $this->app['url_generator']->generate('homepage');

            return $item;
        }

        // We have a mistakenly placed URL, allow it but log it.
        if (preg_match('#^(https?://|//)#i', $item['path'])) {
            $item['link'] = $item['path'];
            $this->app['logger.system']->error(
                Trans::__(
                    'Invalid menu path (%PATH%) set in menu.yml. Probably should be a link: instead!',
                    ['%PATH%' => $item['path']]
                ),
                ['event' => 'config']
            );

            return $item;
        }

        // Get a copy of the path minus trailing/leading slash
        $path = trim($item['path'], '/');

        // Pre-set our link in case the match() throws an exception
        $basePath = '';
        if ($request = $this->app['request_stack']->getCurrentRequest()) {
            $basePath = $request->getBasePath();
        }
        $item['link'] = $basePath . '/' . $path;

        try {
            // See if we have a 'content/id' or 'content/slug' path
            if (preg_match('#^([a-z0-9_-]+)/([a-z0-9_-]+)$#i', $path)) {
                // Determine if the provided path first matches any routes
                // that we have, this will catch any valid configured
                // contenttype slug and record combination, or throw a
                // ResourceNotFoundException exception otherwise
                $this->app['url_matcher']->match('/' . $path);

                // If we found a valid routing match then we're still here,
                // attempt to retrieve the actual record and use its values.
                $item = $this->populateItemFromRecord($item, $path);
            }
        } catch (ResourceNotFoundException $e) {
            $this->app['logger.system']->error(
                Trans::__(
                    'Invalid menu path (%PATH%) set in menu.yml. Does not match any configured contenttypes or routes.',
                    ['%PATH%' => $item['path']]
                ),
                ['event' => 'config']
            );
        } catch (MethodNotAllowedException $e) {
            // Route is probably a GET and we're currently in a POST
        }

        return $item;
    }
private function resolvePathToContent(array $item)
    {
        if ($item['path'] === 'homepage') {
            $item['link'] = $this->app['url_generator']->generate('homepage');

            return $item;
        }

        // We have a mistakenly placed URL, allow it but log it.
        if (preg_match('#^(https?://|//)#i', $item['path'])) {
            $item['link'] = $item['path'];
            $this->app['logger.system']->error(
                Trans::__(
                    'Invalid menu path (%PATH%) set in menu.yml. Probably should be a link: instead!',
                    ['%PATH%' => $item['path']]
                ),
                ['event' => 'config']
            );

            return $item;
        }

        // Get a copy of the path minus trailing/leading slash
        $path = trim($item['path'], '/');

        // Pre-set our link in case the match() throws an exception
        $basePath = '';
        if ($request = $this->app['request_stack']->getCurrentRequest()) {
            $basePath = $request->getBasePath();
        }
        $item['link'] = $basePath . '/' . $path;

        try {
            // See if we have a 'content/id' or 'content/slug' path
            if (preg_match('#^([a-z0-9_-]+)/([a-z0-9_-]+)$#i', $path)) {
                // Determine if the provided path first matches any routes
                // that we have, this will catch any valid configured
                // contenttype slug and record combination, or throw a
                // ResourceNotFoundException exception otherwise
                $this->app['url_matcher']->match('/' . $path);

                // If we found a valid routing match then we're still here,
                // attempt to retrieve the actual record and use its values.
                $item = $this->populateItemFromRecord($item, $path);
            }
        } catch (ResourceNotFoundException $e) {
            $this->app['logger.system']->error(
                Trans::__(
                    'Invalid menu path (%PATH%) set in menu.yml. Does not match any configured contenttypes or routes.',
                    ['%PATH%' => $item['path']]
                ),
                ['event' => 'config']
            );
        } catch (MethodNotAllowedException $e) {
            // Route is probably a GET and we're currently in a POST
        }

        return $item;
    }
private function resolvePathToContent ( array $ item ) { if ( $ item [ 'path' ] === 'homepage' ) { $ item [ 'link' ] = $ this -> app [ 'url_generator' ] -> generate ( 'homepage' ) ; return $ item ; } // We have a mistakenly placed URL, allow it but log it. if ( preg_match ( '#^(https?://|//)#i' , $ item [ 'path' ] ) ) { $ item [ 'link' ] = $ item [ 'path' ] ; $ this -> app [ 'logger.system' ] -> error ( Trans :: __ ( 'Invalid menu path (%PATH%) set in menu.yml. Probably should be a link: instead!' , [ '%PATH%' => $ item [ 'path' ] ] ) , [ 'event' => 'config' ] ) ; return $ item ; } // Get a copy of the path minus trailing/leading slash $ path = trim ( $ item [ 'path' ] , '/' ) ; // Pre-set our link in case the match() throws an exception $ basePath = '' ; if ( $ request = $ this -> app [ 'request_stack' ] -> getCurrentRequest ( ) ) { $ basePath = $ request -> getBasePath ( ) ; } $ item [ 'link' ] = $ basePath . '/' . $ path ; try { // See if we have a 'content/id' or 'content/slug' path if ( preg_match ( '#^([a-z0-9_-]+)/([a-z0-9_-]+)$#i' , $ path ) ) { // Determine if the provided path first matches any routes // that we have, this will catch any valid configured // contenttype slug and record combination, or throw a // ResourceNotFoundException exception otherwise $ this -> app [ 'url_matcher' ] -> match ( '/' . $ path ) ; // If we found a valid routing match then we're still here, // attempt to retrieve the actual record and use its values. $ item = $ this -> populateItemFromRecord ( $ item , $ path ) ; } } catch ( ResourceNotFoundException $ e ) { $ this -> app [ 'logger.system' ] -> error ( Trans :: __ ( 'Invalid menu path (%PATH%) set in menu.yml. Does not match any configured contenttypes or routes.' , [ '%PATH%' => $ item [ 'path' ] ] ) , [ 'event' => 'config' ] ) ; } catch ( MethodNotAllowedException $ e ) { // Route is probably a GET and we're currently in a POST } return $ item ; }
Determine the type of path we have.

@param array $item

@return array
Determine the type of path we have .