The Knp University site there’s a new post showing you an interesting thing you can do with Symfony2 service definitions – use more complex expressions to load and supply service dependencies.
[Using] the @= means that you’re using Symfony’s Expression Language, which let’s you mix dynamic logically into your normally-static service definitions. Normally, if you want to inject a repository, you need to register it as a service first, using a factory. And while that’s fine (and probably better if you’re injecting the factory a lot), using the expression language is well, kinda cool.
They include an example of the compiled container code that would be produced from the example expression. They also show how to use the same expression language to read configuration information and pass it in as an argument to the created service. The show the pull of a configuration setting „email_from_username“ and how to inject it via the expression language.