Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove return type declaration to Interceptor classes #11

Open
thedotwriter opened this issue Jan 3, 2023 · 0 comments
Open

Remove return type declaration to Interceptor classes #11

thedotwriter opened this issue Jan 3, 2023 · 0 comments

Comments

@thedotwriter
Copy link

Hi,

Since 1.4.2, you've added return type declarations pointing to Interceptors. You probably meant to use Interfaces.

As an example, you've added return type declarations ?ProductInterceptor (Magento\Catalog\Model\Product\Interceptor) to :

  • \Lengow\Connector\Model\Export\Product::getProduct
  • \Lengow\Connector\Model\Export\Product::getParentProduct
  • \Lengow\Connector\Model\Export\Product::getConfigurableProduct

Please, use \Magento\Catalog\Api\Data\ProductInterface instead. Otherwise, everythings breaks when a module applies a preference on the Product model.

Error on the export process:

TypeError: Return value of Lengow\Connector\Model\Export\Product::getProduct() must be an instance of Magento\Catalog\Model\Product\Interceptor or null, instance of DialogInsight\DI\Model\Override\Catalog\Product\Interceptor returned in /path/to/website/vendor/lengow/module-connector/Model/Export/Product.php:556
Stack trace:
#0 /path/to/website/vendor/lengow/module-connector/Model/Export/Product.php(312): Lengow\Connector\Model\Export\Product->getProduct()
#1 /path/to/website/generated/code/Lengow/Connector/Model/Export/Product/Interceptor.php(32): Lengow\Connector\Model\Export\Product->load()
#2 /path/to/website/vendor/lengow/module-connector/Model/Export.php(532): Lengow\Connector\Model\Export\Product\Interceptor->load()
#3 /path/to/website/vendor/lengow/module-connector/Model/Export.php(454): Lengow\Connector\Model\Export->export()
#4 /path/to/website/generated/code/Project/Lengow/Model/Export/Interceptor.php(50): Lengow\Connector\Model\Export->exec()
#5 /path/to/website/vendor/lengow/module-connector/Controller/Export/Index.php(190): Project\Lengow\Model\Export\Interceptor->exec()
#6 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(58): Lengow\Connector\Controller\Export\Index->execute()
#7 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(138): Lengow\Connector\Controller\Export\Index\Interceptor->___callParent()
#8 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(153): Lengow\Connector\Controller\Export\Index\Interceptor->Magento\Framework\Interception\{closure}()
#9 /path/to/website/generated/code/Lengow/Connector/Controller/Export/Index/Interceptor.php(23): Lengow\Connector\Controller\Export\Index\Interceptor->___callPlugins()
#10 /path/to/website/vendor/magento/framework/App/Action/Action.php(111): Lengow\Connector\Controller\Export\Index\Interceptor->execute()
#11 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch()
#12 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(138): Lengow\Connector\Controller\Export\Index\Interceptor->___callParent()
#13 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(153): Lengow\Connector\Controller\Export\Index\Interceptor->Magento\Framework\Interception\{closure}()
#14 /path/to/website/generated/code/Lengow/Connector/Controller/Export/Index/Interceptor.php(32): Lengow\Connector\Controller\Export\Index\Interceptor->___callPlugins()
#15 /path/to/website/vendor/magento/framework/App/FrontController.php(245): Lengow\Connector\Controller\Export\Index\Interceptor->dispatch()
#16 /path/to/website/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#17 /path/to/website/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#18 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#19 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#20 /path/to/website/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(99): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#21 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch()
#22 /path/to/website/vendor/fastly/magento2/Model/FrontControllerPlugin.php(128): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#23 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(135): Fastly\Cdn\Model\FrontControllerPlugin->aroundDispatch()
#24 /path/to/website/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(71): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#25 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch()
#26 /path/to/website/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#27 /path/to/website/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#28 /path/to/website/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#29 /path/to/website/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#30 /path/to/website/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#31 /path/to/website/pub/index.php(29): Magento\Framework\App\Bootstrap->run()
#32 {main}

You don't use it in the code but it's the same issue with all occurences of StoreInterceptor. You never have to call any Interceptor class yourself.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant