Question

I've an entity, Article, and I'd like to write a listener which needs to transform a field using a webservice.

Actually listener are added as is without any dependencies.

I'm wondering if it is right to add my service to the constructor to be able to use it to transform my field.

If not, what would be the best way to do ?

Was it helpful?

Solution

On my opinion, listeners are kind of services, so they can receive other services as parameters.

The bad thing I sometimes see is to try to inject services in an entity that is in the Model layer...

So... go for it !

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top