88namespace Magento \Sales \Controller \Adminhtml \Order ;
99
1010use Magento \Backend \App \Action ;
11- use Magento \Catalog \Model \Product ;
1211use Magento \Framework \App \ObjectManager ;
1312use Magento \Framework \View \Result \PageFactory ;
1413use Magento \Backend \Model \View \Result \ForwardFactory ;
1514use Magento \Sales \Model \Order \Create \ValidateCoupon ;
16- use Magento \Catalog \Api \ProductRepositoryInterface ;
1715
1816/**
1917 * Adminhtml sales orders creation process controller
@@ -56,11 +54,6 @@ abstract class Create extends \Magento\Backend\App\Action
5654 */
5755 private $ validateCoupon ;
5856
59- /**
60- * @var ProductRepositoryInterface
61- */
62- private ProductRepositoryInterface $ productRepository ;
63-
6457 /**
6558 * @param Action\Context $context
6659 * @param \Magento\Catalog\Helper\Product $productHelper
@@ -75,16 +68,13 @@ public function __construct(
7568 \Magento \Framework \Escaper $ escaper ,
7669 PageFactory $ resultPageFactory ,
7770 ForwardFactory $ resultForwardFactory ,
78- ?ProductRepositoryInterface $ productRepository = null ,
7971 ?ValidateCoupon $ validateCoupon = null
8072 ) {
8173 parent ::__construct ($ context );
8274 $ productHelper ->setSkipSaleableCheck (true );
8375 $ this ->escaper = $ escaper ;
8476 $ this ->resultPageFactory = $ resultPageFactory ;
8577 $ this ->resultForwardFactory = $ resultForwardFactory ;
86- $ this ->productRepository = $ productRepository ?: ObjectManager::getInstance ()
87- ->get (ProductRepositoryInterface::class);
8878 $ this ->validateCoupon = $ validateCoupon ?: ObjectManager::getInstance ()->get (ValidateCoupon::class);
8979 }
9080
@@ -291,8 +281,11 @@ function ($v) {
291281 }
292282 if ($ this ->_getQuote ()->hasProductId ((int )$ productId ) && !$ hasOptionsInConfig ) {
293283 try {
294- /** @var Product $product */
295- $ product = $ this ->productRepository ->getById ($ productId );
284+ /** @var \Magento\Catalog\Model\Product $product */
285+ $ product = $ this
286+ ->_objectManager
287+ ->create (\Magento \Catalog \Model \Product::class)
288+ ->load ($ productId );
296289 if ($ product ->getId () && $ product ->getHasOptions ()) {
297290 $ hasRequired = false ;
298291 foreach ($ product ->getOptions () as $ option ) {
0 commit comments