I have two routing files in my project:
event.yml
user.yml
I'm trying to add a new route to event.yml file :
registro_eventos:
path: /evento
defaults: { _controller: AppBundle:Event:registroevento }
The function registroeventoAction on the EventController.php
file is:
public function registroeventoAction(Request $request)
{
$evento = new Evento();
$form = $this->createForm(EventoType::class, $evento);
return $this->render('AppBundle:Event:registroeventos.html.twig',array(
'form' => $form->createView()
));
}
When I try the route, the answer is err_invalid_response
(just like if the route doesnt exists).
I've tryied to add different routes to the same file and always the same amswer (I have to say that the previous routes in this file works ok! )
Finally I've added the route to the user.yml
file and works!
Does anyone have an idea why is this happening?
Thanks in advance for your help!
Arturo
Adding information:
The content of the app/config/routing.yml is:
app:
resource: "@AppBundle/Resources/config/routing.yml"
prefix: /
The content of the AppBundle/Resources/config/routing.yml is:
app_user:
resource: "@AppBundle/Resources/config/routing/user.yml"
prefix: /
app_event:
resource: "@AppBundle/Resources/config/routing/event.yml"
prefix: /
app_homepage:
path: /
defaults: { _controller: AppBundle:User:login }
app_candidato:
resource: "@AppBundle/Resources/config/routing/candidato.yml"
prefix: /
This is the content of AppBundle/Resources/config/routing/event.yml (this routes are working propperly, but if I add a new route, this doesn't)
home:
path: /home
defaults: { _controller: AppBundle:Event:index }
indice_eventos:
path: /indice_eventos
defaults: { _controller: AppBundle:Event:indice }
inscriptos_evento:
path: /inscriptos/{slugevento}
defaults: { _controller: AppBundle:Event:listadoInscriptos, slugevento:null }
inscriptos_excel:
path: /{_filename}.{_format}
defaults: { _controller: AppBundle:Event:excelInscriptos, _format: xlsx }
inicia_registro:
path: /inicia_registro
defaults: { _controller: AppBundle:Event:iniciaRegistro }
datos_personales:
path: /datos_personales
defaults: { _controller: AppBundle:Event:datosPersonales }
And finally the content of AppBundle/Resources/config/routing/user.yml
login:
path: /login
defaults: { _controller: AppBundle:User:login }
login_check:
path: /login_check
logout:
path: /logout
register:
path: /register
defaults: { _controller: AppBundle:User:register }
user_email_test:
path: /email-test
defaults: { _controller: AppBundle:User:emailTest }
methods: [POST]
user_edit:
path: /my-data
defaults: { _controller: AppBundle:User:editUser }
usuarios_list:
path: /usuarios
defaults: { _controller: AppBundle:User:usuarios }
usuarios_search:
path: /search
defaults: { _controller: AppBundle:User:search }
registro_eventos:
path: /evento
defaults: { _controller: AppBundle:Event:registroevento }
editar_evento:
path: /evento/{idevento}
defaults: { _controller: AppBundle:Event:editevento, idevento:null }
borrar_evento:
path: /delevento/{idevento}
defaults: { _controller: AppBundle:Event:deleteEvento, idevento:null }
In file app/config/routing.yml
you should add the routing files:
my_events:
prefix: /events
resource: "@appBundle/Resources/config/event.yml"
You can access using "PATH/events/evento"