I'm moving my old codebase to the Symfony 2.2 framework.
In my old code, my Article entity has had a method getUrl(), which was returning a URL for current article.
In Symfony i have to use Router service to generate such an URLs.
I can't access Router from inside the Entity, cause it's a bad practice and not really supported by the framework.
I can call the router from the Twig template itself using Twig helper path() and provide all the arguments (from the Article instance) needed to construct the URL. But this approach is not very good, cause if i'll decide to change URL formatting rules - i will have to find all this calls and rewrite them (not very DRY).
I really want to save the business-logic encapsulation here and not to pull all the guts to the view layer.
How should i proceed in this situation?