Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
LinkManagement Class Reference
Inheritance diagram for LinkManagement:
ProductLinkManagementInterface

Public Member Functions

 __construct (ProductRepositoryInterface $productRepository, \Magento\Bundle\Api\Data\LinkInterfaceFactory $linkFactory, \Magento\Bundle\Model\SelectionFactory $bundleSelection, \Magento\Bundle\Model\ResourceModel\BundleFactory $bundleFactory, \Magento\Bundle\Model\ResourceModel\Option\CollectionFactory $optionCollection, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper)
 

Protected Member Functions

 mapProductLinkToSelectionModel (\Magento\Bundle\Model\Selection $selectionModel, \Magento\Bundle\Api\Data\LinkInterface $productLink, $linkedProductId, $parentProductId)
 

Protected Attributes

 $productRepository
 
 $linkFactory
 
 $bundleFactory
 
 $bundleSelection
 
 $optionCollection
 
 $dataObjectHelper
 

Detailed Description

@SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 20 of file LinkManagement.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ProductRepositoryInterface  $productRepository,
\Magento\Bundle\Api\Data\LinkInterfaceFactory  $linkFactory,
\Magento\Bundle\Model\SelectionFactory  $bundleSelection,
\Magento\Bundle\Model\ResourceModel\BundleFactory  $bundleFactory,
\Magento\Bundle\Model\ResourceModel\Option\CollectionFactory  $optionCollection,
\Magento\Store\Model\StoreManagerInterface  $storeManager,
\Magento\Framework\Api\DataObjectHelper  $dataObjectHelper 
)
Parameters
ProductRepositoryInterface$productRepository
\Magento\Bundle\Api\Data\LinkInterfaceFactory$linkFactory
\Magento\Bundle\Model\SelectionFactory$bundleSelection
\Magento\Bundle\Model\ResourceModel\BundleFactory$bundleFactory
\Magento\Bundle\Model\ResourceModel\Option\CollectionFactory$optionCollection
\Magento\Store\Model\StoreManagerInterface$storeManager
\Magento\Framework\Api\DataObjectHelper$dataObjectHelper

Definition at line 66 of file LinkManagement.php.

74  {
75  $this->productRepository = $productRepository;
76  $this->linkFactory = $linkFactory;
77  $this->bundleFactory = $bundleFactory;
78  $this->bundleSelection = $bundleSelection;
79  $this->optionCollection = $optionCollection;
80  $this->storeManager = $storeManager;
81  $this->dataObjectHelper = $dataObjectHelper;
82  }
$storeManager

Member Function Documentation

◆ mapProductLinkToSelectionModel()

mapProductLinkToSelectionModel ( \Magento\Bundle\Model\Selection  $selectionModel,
\Magento\Bundle\Api\Data\LinkInterface  $productLink,
  $linkedProductId,
  $parentProductId 
)
protected
Parameters
\Magento\Bundle\Model\Selection$selectionModel
\Magento\Bundle\Api\Data\LinkInterface$productLink
string$linkedProductId
string$parentProductId
Returns
\Magento\Bundle\Model\Selection @SuppressWarnings(PHPMD.CyclomaticComplexity) @SuppressWarnings(PHPMD.NPathComplexity)

Definition at line 180 of file LinkManagement.php.

185  {
186  $selectionModel->setProductId($linkedProductId);
187  $selectionModel->setParentProductId($parentProductId);
188  if ($productLink->getSelectionId() !== null) {
189  $selectionModel->setSelectionId($productLink->getSelectionId());
190  }
191  if ($productLink->getOptionId() !== null) {
192  $selectionModel->setOptionId($productLink->getOptionId());
193  }
194  if ($productLink->getPosition() !== null) {
195  $selectionModel->setPosition($productLink->getPosition());
196  }
197  if ($productLink->getQty() !== null) {
198  $selectionModel->setSelectionQty($productLink->getQty());
199  }
200  if ($productLink->getPriceType() !== null) {
201  $selectionModel->setSelectionPriceType($productLink->getPriceType());
202  }
203  if ($productLink->getPrice() !== null) {
204  $selectionModel->setSelectionPriceValue($productLink->getPrice());
205  }
206  if ($productLink->getCanChangeQuantity() !== null) {
207  $selectionModel->setSelectionCanChangeQty($productLink->getCanChangeQuantity());
208  }
209  if ($productLink->getIsDefault() !== null) {
210  $selectionModel->setIsDefault($productLink->getIsDefault());
211  }
212 
213  return $selectionModel;
214  }

Field Documentation

◆ $bundleFactory

$bundleFactory
protected

Definition at line 35 of file LinkManagement.php.

◆ $bundleSelection

$bundleSelection
protected

Definition at line 40 of file LinkManagement.php.

◆ $dataObjectHelper

$dataObjectHelper
protected

Definition at line 50 of file LinkManagement.php.

◆ $linkFactory

$linkFactory
protected

Definition at line 30 of file LinkManagement.php.

◆ $optionCollection

$optionCollection
protected

Definition at line 45 of file LinkManagement.php.

◆ $productRepository

$productRepository
protected

Definition at line 25 of file LinkManagement.php.


The documentation for this class was generated from the following file: