Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions app/code/Magento/CatalogRule/Model/Rule/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
* See COPYING.txt for license details.
*/

namespace Magento\CatalogRule\Model\Rule;

use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;

/**
* Catalog Rule job model
*
Expand All @@ -18,13 +22,8 @@
* @method bool hasSuccess()
* @method bool hasError()
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\CatalogRule\Model\Rule;

use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;

/**
* @author Magento Core Team <[email protected]>
*
* @api
* @since 100.0.2
*/
Expand All @@ -39,10 +38,14 @@ class Job extends \Magento\Framework\DataObject
* Basic object initialization
*
* @param RuleProductProcessor $ruleProcessor
* @param array $data
*/
public function __construct(RuleProductProcessor $ruleProcessor)
{
public function __construct(
RuleProductProcessor $ruleProcessor,
array $data = []
) {
$this->ruleProcessor = $ruleProcessor;
parent::__construct($data);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Magento\Catalog\Api\Data\ProductLinkExtensionFactory;
use Magento\Catalog\Api\Data\ProductLinkInterfaceFactory;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\GroupedProduct\Model\Product\Type\Grouped as TypeGrouped;

/**
Expand Down Expand Up @@ -60,6 +61,9 @@ public function __construct(
* @param array $links
*
* @return \Magento\Catalog\Model\Product
*
* @throws NoSuchEntityException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
Expand All @@ -70,7 +74,7 @@ public function beforeInitializeLinks(
array $links
) {
if ($product->getTypeId() === TypeGrouped::TYPE_CODE && !$product->getGroupedReadonly()) {
$links = (isset($links[self::TYPE_NAME])) ? $links[self::TYPE_NAME] : $product->getGroupedLinkData();
$links = $links[self::TYPE_NAME] ?? $product->getGroupedLinkData();
if (!is_array($links)) {
$links = [];
}
Expand Down