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.
The changes made in this pull request are as follows:
Updated version
Replaced the __construct() method with multiple methods that utilize ObjectManager to instantiate the necessary instances. This change was made to prevent errors during code complication:
Replaced the $excludedCustomAttributes property with a constant. Using a class constant for a fixed value that will be used within a method helps to clearly define and identify the value as a constant for that class. It also ensures that the value remains consistent and cannot be changed or modified within the class methods.
Removed nullable parameter type from the $attributes param, as it must be of type array since it is used as the second param in an array_merge()function, which requires an array type.
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.
The changes made in this pull request are as follows:
__construct()
method with multiple methods that utilize ObjectManager to instantiate the necessary instances. This change was made to prevent errors during code complication:$stockRegistry
.$excludedCustomAttributes
property with a constant. Using a class constant for a fixed value that will be used within a method helps to clearly define and identify the value as a constant for that class. It also ensures that the value remains consistent and cannot be changed or modified within the class methods.$attributes
param, as it must be of type array since it is used as the second param in anarray_merge()
function, which requires an array type.