0

In vendor\magento\module-catalog\Helper\Image.php you can find this parameter in the constructor:

\Magento\Catalog\Model\Product\ImageFactory $productImageFactory

but where is the class located? I searched in vendor\magento\module-catalog\Model\Product\ but there is no such file??

1 Answer 1

3

Factories are service classes that instantiate non-injectable classes, You do not need to explicitly define them because they are an automatically generated class type. When you reference a factory in a class constructor, Magento’s object manager generates the factory class if it does not exist

You will find the Image.php file at:

vendor/magento/module-catalog/Model/Product/Image.php

Factory class generated by Magento and stored in generated directory. You will find the factory class at:

generated/code/Magento/Catalog/Model/Product/ImageFactory.php

For more information about Factories check the link: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/factories.html

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.