Closed TuVanDev closed 2 months ago
It is worth saying that there is no need to check if the instance of theProductMetadataInterface
interface contains the getVersion
method, as this method always exists in Magento 2. You can refer to the code in the following links for confirmation:
https://github.com/magento/magento2/blob/2.0/lib/internal/Magento/Framework/App/ProductMetadataInterface.php#L17
https://github.com/magento/magento2/blob/2.4.7/lib/internal/Magento/Framework/App/ProductMetadataInterface.php#L21
Can you try removing constructor override and try something like this instead? https://github.com/magento/magento2/issues/30684#issuecomment-722602562
As of Magento 2.4.7, backward compatibility has been lost in the Magento\Catalog\Model\ProductRepository class. This pull request aims to fix this issue.
Check the issue page in the Magento repo for reference: https://github.com/magento/magento2/issues/38669.