Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6685615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:04:39+00:00 2026-05-26T05:04:39+00:00

in order to create a navigation for me webinterface I’d like to get a

  • 0

in order to create a navigation for me webinterface I’d like to get a variable from the routing config of my bundle. I define the available pages in mybundle/Resources/config/routing.yml.

mybundle_homepage:
  pattern:  /{_locale}/{branch}/{page}
  defaults: { _controller: mybundle:mycontroller:index, _locale: de, branch: x.x.x, page: start }
  requirements:
    _locale:  de|en
    page:     start|functions|events|constants|styleguide

Now I had a look at the Symfony2 YAML Parser and I have to provide a filepath to it’s static method parse: http://symfony.com/doc/2.0/reference/YAML.html

mycontroller.php

use Symfony\Component\Yaml\Yaml;

class mycontroller extends Controller
{
  public function indexAction($_locale, $branch, $page)
  {
    $routing = Yaml::parse('../Resources/config/routing.yml');
    var_dump($routing);
  }
}

I thought I could do it that way because the folder hirarchy looks like that:

  • mybundle
    • Controller
      • mycontroller.php
    • Rescources
      • config
        • routing.yml

But it’s not working. Any ideas or maybe another way to get the requirements.page array from the routing file?

Regards, Ben

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:04:39+00:00Added an answer on May 26, 2026 at 5:04 am

    You should be able to access the router service inside a class that’s DI container aware. So, you can write something like:

    $routes = $this->container->get('router')->getRouteCollection();
    
    $route = $routes->get('my_route_name');
    print_r($route->getRequirements());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to create an arbitrary precision floating point / drop in replacement for
In order to create the proper queries I need to be able to run
Right now I'm using JFreeChart in order to create a dynamic chart. However the
I'm using the openssl utility of debian in order to create a certificate. The
I'm using the following script in my website in order to create pagination next-previous
I need to reverse engineer a Microsoft SQL Server 2008 in order to create
I've created a custom method called checkout in my app. I create an order
i create a form for order a item in flex. i use <mx:TextInput />
I'm trying to create a hash that preserves the order that the keys are
I'm currently trying to create a subclass of UIImageView in order to make it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.