Q
Q
Quber2014-03-28 06:27:24
symfony
Quber, 2014-03-28 06:27:24

Symfony 2 - how to navigate to the second route?

I don't know how to phrase the question. In general, there are two routes:

site.ru/переменная/
site.ru/другая_переменная/

Each route leads to its own controller.
For any request, the first route will work, respectively, and its controller too. Next, the value is searched in the database, and if the value is not found, you need to go to the second route and its controller, how to do this?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
B
brevis, 2014-03-28
@brevis

symfony.com/doc/current/book/controller.html#forwarding

A
Alexey Krichko, 2014-03-28
@sand_alkr

You can remove the closing slash from one of the routes:

site.ru/переменная
site.ru/другая_переменная/

J
JekaRu, 2014-04-03
@JekaRu

Perhaps this will suit you https://github.com/symfony-cmf/Routing

A
Alexander, 2014-04-10
@neokortex

I am using forwarding.
if ($condition) {
$response = $this->forward('ProjectNameBundle:Entity:controllerName', array(
'router_param' => $router_param,
));
return $response;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question