I am trying to inject a service model from my module into a widget,
The Module is located in /modules_app/ where i divided my models folder into “orm” and “services”
In my ModuleConfig i added both directories to the binder.
My widget is located in: /modules_app/contentbox_custom/_widgets/
When I inject the service model via property name="" inject="" contentbox tells me that the injected object cannot be found. I also tried it with @ before adding the static bindings.
When i am loading an instance of my service in the “renderIt” function everything works, however since the service is a singleton this should not be the way to use the service.
Am I missing something? Are my assumptions of where to place the widgets and my main model right?
I completely forgot to mention the versions I am using:
My problem just got worse:
I also tried to inject an orm model in a different widget.
My orm models are in an orm folder in the same models folder as my services folder.
The same injection worked in my previously mentioned widget, however in the second widget it is not working anymore…
Upon inspecting the contentbox.log I found that in my service an injection of an orm model failed, however, another injection of a different model worked fine. (Also the service is working when injected)
I think something is wrong with the injections, however as they are working sometimes I cannot see whats failing.
I just solved the Problem:
In some cases I still had the @ appended to my injecion. However since I added the directorry mappings this failed. I removed all @ references of injections which pointed at my module. Now things are working fine!