is there any way to pass parameter into service from SESSION or other source?
I have something like this in my bundle configuration:
<service id="class" class="MyClass">
<argument key="lang">%class.lang%</argument>
</service>
I know that it can be done by passing parameter from Extension in DependencyInjection but I’m not sure about the source of this variable, it might be session but in some cases it could be readed from database. I just dont want to hardcode in DependencyInjection that parameter should be passed from session.
I know also that I can pass parameter from app config but is there any way to change it after some acction in application?
If that parameter is not fixed by configuration (i.e. if it depends on some application logic) I would put it inside a specific class, register the class as a specific service (injecting all needed services to determine the value you are interested in) and then inject the specific service where you need that value.