Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TypeTransitionManager.php
Go to the documentation of this file.
1 <?php
10 
13 
15 {
21  protected $compatibleTypes;
22 
26  protected $weightResolver;
27 
32  public function __construct(
33  \Magento\Catalog\Model\Product\Edit\WeightResolver $weightResolver,
34  array $compatibleTypes
35  ) {
36  $this->compatibleTypes = $compatibleTypes;
37  $this->weightResolver = $weightResolver;
38  }
39 
46  public function processProduct(Product $product)
47  {
48  if (in_array($product->getTypeId(), $this->compatibleTypes)) {
49  $product->setTypeInstance(null);
50  $productTypeId = $this->weightResolver->resolveProductHasWeight($product)
53  $product->setTypeId($productTypeId);
54  }
55  }
56 }
__construct(\Magento\Catalog\Model\Product\Edit\WeightResolver $weightResolver, array $compatibleTypes)