K
K
kapai692015-04-28 20:51:07
symfony
kapai69, 2015-04-28 20:51:07

What will routing look like for an infinite number of pages?

For example:
site.ru/page1/page2/page3
add another
site.ru/page1/page2/page3/add_page
we get:
site.ru/page1/page2/page3/page4

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
keltanas, 2015-04-29
@kapai69

A completely working scheme is obtained if you use Doctrine Behavior Tree to implement nesting, and Symfony CMF Dynamic Router to route through this structure.
Roughly speaking, you need to implement a certain service:

namespace AppBundle\Router;

use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider;
use Symfony\Cmf\Component\Routing\RouteProviderInterface;

class RouterProvider extends DoctrineProvider implements RouteProviderInterface
{
    // ...
}

which will be connected to the ChainRouter along with the system router, and will load pages from the database, based on the hierarchy of which to build and resolve routes.

D
Denis, 2015-04-28
@prototype_denis

<?php
    /**
     * @Route("/", name="main")
     * @Route("/{query}", name="main_query", requirements={"query": ".+"})
     */
    public function mainAction($query = null)
    {
        // ...
    }

PS: You shouldn't do that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question