Routing, Symfonized

2018-07-18

YAML, here we come

As you probably know, a long-term goal of OpenPSA development is to reduce both the maintenance burden and the learning curve, by slowly replacing the framework's lowlevel infrastructure with Symfony components. Recently, we've made another big step in this direction by switching to Symfony Routing. This means that starting now, you can create your routes in YAML files in the regular Symfony format. This not only improves readbility, but also gives you access to a lot more validation and other features.

The second effect of this change is that now, URLs can be generated. So instead of hardcoding links, you simly call the router's generate() method, and it takes care of the rest. It might seem like a small thing, but you will appreciate it the next time you need to change URLs: Instead of searching the entire codebase with some fuzzy regexes, you simply update the routes file, and all the rest is taken care of by the framework.

Currently, Symfony Routing is available inside components (i.e. topic routing and midcom routes still use the traditional mechanism), and legacy component routing is still supported, so nothing changes immediately for existing code. However, the conversion from the old .inc format to .yml is really straightforward and can be done quite quickly, so don't expect the legacy support to stick around forever. Especially since there are a number of further improvements the new routing enables (which will probably require us to drop legacy support), but more on that in another post..

 

Enjoy!

Comments:

There have been no comments so far.

Post a comment:

This is a Captcha (http://en.wikipedia.org/wiki/Captcha), you need a graphical browser to display it.
This is a Captcha. You have to enter the characters displayed in the image taking case sensitivity into account.

Back

Layout Copyright © 2006 Finnish Teleservice Center Ltd Oy - Site Powered by Midgard CMS, hosted by CONTENT CONTROL