ramoska blog logo showing grasshoper

ramoska

Adding dynamic routing (a.k.a navigation) to project

Posted on February 2016 in Web development

Previous post was about creating simple CRUD application with password protected administrator's dashboard. I thought that using Sonata CMF I would be able to quickly build working prototype and test framework's possibilities on project I was working on. At first glance it was quite good fit:

  • has many downloads
  • has many bundles
  • latest commits were not so old (few days old actually)
  • has built-in administration dashboard

What I don't like about Sonata is that multi-language is solved via multi-site, which means that site for each locale is practically separate sub-site. Also Sonata was created as e-commerce solution and does not quite fit my needs, which are:

  • dynamic (and very specific) menu
  • which leads to dynamic routing

After looking into some solutions Symfony CMF's menu bundle with routing bundle seemed like a solution. After trying to install required packages (composer require ...) a lot of dependency issues emerged. Not to have these issues one option was to use Symfony 2.3. Not an valid option having in mind that end of support for 2.3 version was next month.

What can we do with Symfony CMF.

First ray of hope is that it uses Sonata's Admin bundle for admin. Secondly routing seems to fit my needs:

In order to address these issues, a new routing system needed to be developed that takes into account the typical needs of CMS routing:

  • User-defined URLs;
  • Multi-site;
  • Multi-language;
  • Tree-like structure for easier management;
  • Content, Menu and Route separation for added flexibility.

The Symfony CMF Routing component was created with these requirements in mind.

Let's start from the beginning:

To be continued.

Tags: Sonata, Symfony, Symfony 2.8, Web Development