6
votes

I am new to symfony2. I am designing a form.

My action for submission is task_new. And my routing.yml is as follows:

task:
    pattern:   /task/
    defaults:  { _controller: AcmeTaskBundle:Task:new}
task_new:
     defaults:{_controller:AcmeTaskBundle:Task:sub}

I want that after submission the form it should go to sub action. when i am running this code I am getting the following error:

Cannot import resource "C:\wamp\www\Symfony\src\Acme\TaskBundle/Resources/config/routing.yml" from "C:/wamp/www/Symfony/app/config\routing.yml".

What should I do?

1
Isn't the pattern parameter required for the 'task_new' route?Geoffrey Brier
The error message tells you that Symfony can't find the routing.yml file supposed to be in the src/Acme/TaskBundle/Resources/config/ folder. Is the file there?fkoessler
Have you tried with: resource: "@AcmeTaskBundle\Resources\config\routing.yml" (backslashes instead of slashes) in the app.config/routing.yml file?fkoessler
@Marronsuisse yep when i am doing this then i am getting new error Cannot import resource "@AcmeTaskBundle\Resources\config outing.yml" from "C:/wamp/www/Symfony/app/config\routing.yml". Make sure the "AcmeTaskBundle" bundle is correctly registered and loaded in the application kernel class.Rohitashv Singhal

1 Answers

9
votes

Such error usually appears when you have error in your resource file. In your case - I guess, you missed the pattern for task_new route

Also check if defaults starts right after 4 spaces from the beginning

task_new:
    defaults: { _controller:AcmeTaskBundle:Task:sub }