Injecting a service into an entity

Viewed 12550

I have an entity called Container which depends on a service, DeviceService.

I currently inject it using an Entity Listener on postLoad. However this is not being injected when just creating the plain object new Container().

Should I create a ContainerFactory where I inject the service into the new object, along with the current listener, or do a smarter way exist in Symfony?

0 Answers
Related