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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:38:29+00:00 2026-05-25T23:38:29+00:00

I just downloaded symfony2 and am beginning to play with routing via annotations. I

  • 0

I just downloaded symfony2 and am beginning to play with routing via annotations. I have my app/config/routing.yml set in the bundle I created to use annotations, and have deleted the Acme bundle and all routing references to it. That said, I’ve tried creating a couple different route annotations in my controller like @Route(“/”) and @Route(“/hello/{name}”) but I’m always greeted with a 404 error (using the dev environment). If I add the route in routing.yml it works just fine even though the routing is configured to use annotations. For whatever reason, my annotations are seemingly being ignored.

Here is my app/config/routing.yml:

DanDefaultBundle:
  resource: "@DanDefaultBundle/Controller/"
  type:     annotation
  prefix:   /

And here is my controller method:

/**
 * @Route("/")
 * @Template()
 */
public function indexAction()
{
    return array('name' => 123);
}

I’ve included the Sensio\Bundle\FrameworkExtraBundle\Configuration\Route namespace – everything as far as I can tell is correct with what I’ve seen in the documentation. What am I overlooking that’s causing symfony2 to seemingly ignore my routing annotations? Again, if I add the routes to the routing yaml everything works so my bundle is working – but annotations seem to be ignored.

Thanks!

Dan

UPDATE:
It looks like I had to add the routes to routing_dev.yml in addition to routing.yml since I was operating in the dev environment. I suppose that’s so you have have different routes in-between development and production? I suppose special care will have to be taken to make sure those routes stay in sync?

  • 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-25T23:38:30+00:00Added an answer on May 25, 2026 at 11:38 pm

    You accidentally removed the inclusion of routing.yml from routing_dev.yml.

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

Sidebar

Related Questions

I just downloaded Scrapy (web crawler) on Windows 32 and have just created a
I just downloaded the Springsource Tool Suite, and I created a simple bean configuration
I just downloaded Eclipse Galileo and installed ADT10 and tried to a phonegap app
Just downloaded netbeans, and curious if I was to play around with JSP's etc.,
I just downloaded Grails 2.0.1. Created a new project and then tried adding the
I just downloaded newsest doc list api, and have a try. My code as
I just downloaded the Java ME Platform SDK 3.0 and created my frist Midlet
Just downloaded IE9 and pulled up a webproject i have with an IHttpHandler that
I just downloaded the mysql-proxy and created this script lua (found in Mysql docs):
I just downloaded a website template that is in a .PSD form. I have

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.