0

Virtual Type XML Declaration:

<virtualType name="SliderSlideImageUploader" type="Magento\Catalog\Model\ImageUploader">
    <arguments>
        <argument name="baseTmpPath" xsi:type="string">pub/media/tmp/slider/images</argument>
        <argument name="basePath" xsi:type="string">pub/media/slider/images</argument>
        <argument name="allowedExtensions" xsi:type="array">
            <item name="jpg" xsi:type="string">jpg</item>
            <item name="jpeg" xsi:type="string">jpeg</item>
            <item name="gif" xsi:type="string">gif</item>
            <item name="png" xsi:type="string">png</item>
        </argument>
    </arguments>
</virtualType>

Dependency Injection:

public function __construct(
    \Magento\Backend\App\Action\Context $context,
    \SliderSlideImageUploader $imageUploader
) {
    parent::__construct($context);
    $this->imageUploader = $imageUploader;
}

I have tried \SliderSlideImageUploader and SliderSlideImageUploader for the constructor class.

I have cleared the cache with bin/magento cache:flush, uninstalled and reinstalled the module...

I have deleted all of var/generation.

Result:

Exception #0 (RuntimeException): Class Vendor\Slider\Controller\Adminhtml\Slide\Image\SliderSlideImageUploader does not exist

Exception #0 (RuntimeException): Class Vendor\Slider\Controller\Adminhtml\Slide\Image\SliderSlideImageUploader does not exist

My only idea now is that it is failing because Magento_Catalog is not in my module.xml sequence.

Anyone have any ideas?

This could potentially solve my problem, testing now: Receiving object specific class which was injected in constructor by three-part extension

1 Answer 1

1

I had to use type to modify the class that was injected.

<type name="Vendor\Slider\Controller\Adminhtml\Slide\Image\Upload">
    <arguments>
        <argument name="imageUploader" xsi:type="object">SliderSlideImageUploader</argument>
    </arguments>
</type>

Your Answer

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

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