Skip to main content
Magento

Return to Answer

replaced http://magento.stackexchange.com/ with https://magento.stackexchange.com/
Source Link

I can't test your code at the moment to solve your issue but I'd like to add something that can be useful.

DI is intended to pass injectables, that are classes that encapsulate some logic. DI shouldn't be used to pass data, the so called newables.

For example, if you need the data you are trying to inject, you should instead inject a class that is responsible of retrieving that data. This kind of classes are called repositories. In some circumstances it's better to use factories.

You can read more here here.

Enjoy.

I can't test your code at the moment to solve your issue but I'd like to add something that can be useful.

DI is intended to pass injectables, that are classes that encapsulate some logic. DI shouldn't be used to pass data, the so called newables.

For example, if you need the data you are trying to inject, you should instead inject a class that is responsible of retrieving that data. This kind of classes are called repositories. In some circumstances it's better to use factories.

You can read more here.

Enjoy.

I can't test your code at the moment to solve your issue but I'd like to add something that can be useful.

DI is intended to pass injectables, that are classes that encapsulate some logic. DI shouldn't be used to pass data, the so called newables.

For example, if you need the data you are trying to inject, you should instead inject a class that is responsible of retrieving that data. This kind of classes are called repositories. In some circumstances it's better to use factories.

You can read more here.

Enjoy.

Source Link
Alessandro Ronchi
  • 3.8k
  • 1
  • 24
  • 28

I can't test your code at the moment to solve your issue but I'd like to add something that can be useful.

DI is intended to pass injectables, that are classes that encapsulate some logic. DI shouldn't be used to pass data, the so called newables.

For example, if you need the data you are trying to inject, you should instead inject a class that is responsible of retrieving that data. This kind of classes are called repositories. In some circumstances it's better to use factories.

You can read more here.

Enjoy.

default

AltStyle によって変換されたページ (->オリジナル) /