doofinder / doofinder-magento2

Open Software License 3.0
10 stars 9 forks source link

Removed function response type to avoid m2.3 errors #201

Closed sofia-doofinder closed 2 years ago

sofia-doofinder commented 2 years ago

We are having the following error in magento 2.3 when requesting the info to the custom API:

Fatal Error: 'Uncaught TypeError: Return value of Doofinder\\Feed\\Model\\ProductRepository::getList() must be an instance of Magento\\Catalog\\Api\\Data\\ProductSearchResultsInterface, instance of Magento\\Framework\\Api\\SearchResults returned in /home/cloudpanel/htdocs/www.lampwise.co.uk/vendor/doofinder/doofinder-magento2/Model/ProductRepository.php:232\nStack trace:\n#0 /home/cloudpanel/htdocs/www.lampwise.co.uk/generated/code/Doofinder/Feed/Model/ProductRepository/Interceptor.php(37): Doofinder\\Feed\\Model\\ProductRepository->getList(Object(Magento\\Framework\\Api\\SearchCriteria))\n#1 [internal function]: Doofinder\\Feed\\Model\\ProductRepository\\Interceptor->getList(Object(Magento\\Framework\\Api\\SearchCriteria))\n#2 /home/cloudpanel/htdocs/www.lampwise.co.uk/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)\n#3 /home/cloudpanel/htdocs/www.lampwise.co.uk/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\\Webapi\\Controller\\Rest\\SynchronousRequestProcessor->proces' in '/home/cloudpanel/htdocs/www.lampwise.co.uk/vendor/doofinder/doofinder-magento2/Model/ProductRepository.php' on line 232

Seems that the getList native function return a diferent type for magento 2.3 than 2.4: error_magento_type_2 error_magento_type

To avoid type errors I've removed the type specification in the function.