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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:18:05+00:00 2026-06-12T15:18:05+00:00

In Symfony2 TWIG, when trying to generate a path like this: <a href={{ path(‘folder_new’,

  • 0

In Symfony2 TWIG, when trying to generate a path like this:

<a href="{{ path('folder_new', { 'folder': folder.id }) }}">

I don’t get the route I expected

Here is what I expected:

http://localhost/site/web/app_dev.php/Media/folder/new/2

here is what I in fact got from the path() command

http://localhost/site/web/app_dev.php/Media/folder/new?folder=2

Why do I get it formatted as a standard querystring (get) variable instead of a route?

  • 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-06-12T15:18:06+00:00Added an answer on June 12, 2026 at 3:18 pm

    The reason is that I named the variable wrong.

    folder_new:
        pattern:  /new/{parent}
        defaults: { _controller: "AcmeBundle:Folder:new", parent : NULL }
    

    In my routing I had called the variable parent and not folder.

    Correct path() should have been like this:

    <a href="{{ path('folder_new', { 'parent': folder.id }) }}">
    

    So, I learned that when Symfony2 can’t find a route parameter matching the variable passed to the path() function, it appends the variable in standard querystring ($__GET) format instead of generating an error message.

    Would have found it quicker if there were an error message, but I see the use of having it the way it is.

    Cheers! =)

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

Sidebar

Related Questions

I am trying to alter the date_widget using symfony2 and twig. I would like
I am trying to alter the date_widget using symfony2 and twig. By default a
I would like to load a new extension in a symfony2 project for twig
Hey I am trying to get the selected option value in my route (annotation).
I'm trying to use Twig (inside Symfony2) to debug a variable that contains a
Symfony2 returns No route found for GET / when I try to run http://localhost/app_dev.php
In Symfony2, when trying to render index.mobile.twig , How would I load index.html.twig when
I'm learning Symfony2. Currently, I'm trying to render a form label in a twig
I am developing an application using symfony2 and twig for templates. The problem comes
I am displaying a form with Symfony2 and Twig, and need to display some

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.