I'd like to put a class name (which has been configured in app/config/config.yml
by the user) in the tag definition of my Bundle's service configuration.
app/config/config.yml
:
my:
class_name: AppBundle\Entity\Product
My bundle's configuration : services.xml
<service id="my.entity_listener" class="My\EventListener\MyListener">
<tag name="doctrine.orm.entity_listener" entity="%my.class_name%" event="preUpdate" />
</service>
Is that possible in any way ? All I can get is %my.class_name%. It isn't replaced in the tag definition. Although, my dependency injection is working as it replaces it well just above, in the same config file :
<service id="my.param_converter" class="My\ParamConverter\MyParamConverter">
<tag name="request.param_converter" converter="user" priority="10" />
<argument type="service" id="doctrine.orm.default_entity_manager" />
<argument>%my.class_name%</argument> <!-- Replaced by AppBundle\Entity\Product -->
</service>