UltimateModuleCreator / umc

Magento 2 Ultimate Module Creator
MIT License
58 stars 10 forks source link

Fatal error: Method Magento\Ui\TemplateEngine\Xhtml\Result::__toString() When generate Module with Image uploader for M2.2 #19

Closed zaheerbadi closed 5 years ago

zaheerbadi commented 5 years ago

When we try to create module for M2.2 version it missed the below code in Model/{YourModelFIle}.php in constructor.

public function __construct( Context $context, Registry $registry, UploaderPool $uploaderPool, AbstractResource $resource = null, DbCollection $resourceCollection = null, array $data = [] ) { $this->uploaderPool = $uploaderPool; /* this line is missing */ parent::__construct($context, $registry, $resource, $resourceCollection, $data); }

So it create error like Fatal error: Method Magento\Ui\TemplateEngine\Xhtml\Result::__toString() must not throw an exception, caught Error: Call to a member function getUploader() on null in D:\wamp64\www\mage227\vendor\magento\module-ui\Component\Wrapper\UiComponent.php on line 0

It was realy hard time to find what actually causing to occure this.

UltimateModuleCreator commented 5 years ago

@zaheerbadi I could not reproduce this on the issue you are describing event with the module you sent me.