Is it possible to set the service id in an argument dynamically (e.g. like a class name which could be set via parameter) in Symfony 2 (xml configs)?
The following does not work
<service id="myservice" class="myservice.php">
<argument type="service" id="%dynamic_service_name%" />
</service>
<service id="service1" class="foobar\service1" />
<service id="service2" class="foobar\service1" />
the idea is to set the param %dynamic_service_name% dynamically to "service1" or "service2", so the needed instance/object is passed to myservice-class, e.g. in the Extension::load() via $container->setParameter('dynamic_service_name','service1');
Thanks a lot