Skip to content

Commit f02d61e

Browse files
committed
Merge branch 'pr-35299' into 2.4-develop-prs
2 parents ff750b9 + 7465e26 commit f02d61e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/code/Magento/Catalog/Model/Product/Option/SaveHandler.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
use Magento\Catalog\Api\Data\ProductInterface;
1212
use Magento\Catalog\Api\ProductCustomOptionRepositoryInterface as OptionRepository;
1313
use Magento\Catalog\Model\Product\Option;
14+
use Magento\Catalog\Model\ResourceModel\Product\Relation;
1415
use Magento\Framework\App\ObjectManager;
1516
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
16-
use Magento\Catalog\Model\ResourceModel\Product\Relation;
1717
use Magento\Framework\Exception\CouldNotSaveException;
1818

1919
/**
@@ -26,12 +26,12 @@ class SaveHandler implements ExtensionInterface
2626
/**
2727
* @var string[]
2828
*/
29-
private $compositeProductTypes = ['grouped', 'configurable', 'bundle'];
29+
private array $compositeProductTypes = ['grouped', 'configurable', 'bundle'];
3030

3131
/**
3232
* @var OptionRepository
3333
*/
34-
protected $optionRepository;
34+
protected OptionRepository $optionRepository;
3535

3636
/**
3737
* @var Relation
@@ -44,7 +44,7 @@ class SaveHandler implements ExtensionInterface
4444
*/
4545
public function __construct(
4646
OptionRepository $optionRepository,
47-
?Relation $relation = null
47+
?Relation $relation = null
4848
) {
4949
$this->optionRepository = $optionRepository;
5050
$this->relation = $relation ?: ObjectManager::getInstance()->get(Relation::class);
@@ -57,6 +57,7 @@ public function __construct(
5757
* @param array $arguments
5858
* @return ProductInterface|object
5959
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
60+
* @throws CouldNotSaveException
6061
*/
6162
public function execute($entity, $arguments = [])
6263
{
@@ -122,12 +123,11 @@ private function processOptionsSaving(array $options, bool $hasChangedSku, Produ
122123
private function isProductHasRelations(ProductInterface $product): bool
123124
{
124125
$result = true;
125-
if (!in_array($product->getId(), $this->compositeProductTypes)
126+
if (!in_array($product->getTypeId(), $this->compositeProductTypes)
126127
&& $this->relation->getRelationsByChildren([$product->getId()])
127128
) {
128129
$result = false;
129130
}
130-
131131
return $result;
132132
}
133133
}

0 commit comments

Comments
 (0)