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 7554253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:17:20+00:00 2026-05-30T11:17:20+00:00

I am currently trying to configure a routing option in Symfony2 so /cms will

  • 0

I am currently trying to configure a routing option in Symfony2 so /cms will route to /cms/role/view. However, the passing of defaults doesn’t seem to work properly.

/src/MyProject/CMSBundle/Resources/config/routing.yml

MyProjectCMS_specific:
pattern:  /cms/{page}/{option}
defaults: { _controller: MyProjectCMSBundle:Main:index, page: role, option: view }
requirements:
    _method: GET

/src/MyProject/CMSBundle/Controller/MainController.php

<?php
    namespace MyProject\CMSBundle\Controller;

    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

    class MainController extends Controller
    {
        public function indexAction($page, $option)
        {
            $response = null;

            /* Switch statement that determines the page to be loaded. */

            return $response;
        }

    }
?>

The problem is that when I try to go to `localhost/app_dev.php/cms’, it gives me the following error:

Controller "MyProject\CMSBundle\Controller\MainController::indexAction()" requires that you provide a value for the "$page" argument (because there is no default value or because there is a non optional argument after this one).
500 Internal Server Error - RuntimeException

However, if I try to visit localhost/app_dev.php/cms/role or localhost/app_dev.php/cms/role/view, it gives me the correct page. I’ve tried adding a default route to /cms, but it still gives me the same error. How is this possible and how can I fix this?

Thanks in advance.

  • 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-30T11:17:22+00:00Added an answer on May 30, 2026 at 11:17 am

    I don’t know what is the difference between what you wrote and

        public function indexAction($page = "role", $option = "view")
    

    but maybe you could try it and tell us.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to add an MSChart to a partial view in ASP.NET MVC
I'm currently trying to port an app from asp.net to php, however I just
I'm trying to configure some WCF stuff. Currently, I have a server which allows
Trying to configure Jenkins CI. Currently just running it from the .war (eventual intention
I am currently trying to configure collective.xsendfile, Apache mod_xsendfile and Plone 4. Apparently the
I'm currently trying to configure Visual Studio to automatically set up the appropriate configurations
I am currently trying to configure an ASP.net Web Application through Web.config, to host
I'm currently trying to configure Subversion/Apache/Trac and I've run into an error that I
Currently i'm trying to configure some of my classes through the PropertyGrid. Now i
I'm trying to figure out how to configure my project such that JPA will

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.