Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Selection.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Bundle\Model;
7 
35 {
41  protected $_catalogData;
42 
51  public function __construct(
52  \Magento\Framework\Model\Context $context,
53  \Magento\Framework\Registry $registry,
54  \Magento\Catalog\Helper\Data $catalogData,
56  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
57  array $data = []
58  ) {
59  $this->_catalogData = $catalogData;
60  parent::__construct($context, $registry, $resource, $resourceCollection, $data);
61  }
62 
68  protected function _construct()
69  {
70  $this->_init(\Magento\Bundle\Model\ResourceModel\Selection::class);
71  parent::_construct();
72  }
73 
79  public function afterSave()
80  {
81  if (!$this->_catalogData->isPriceGlobal() && $this->getWebsiteId()) {
82  $this->getResource()->saveSelectionPrice($this);
83 
84  if (!$this->getDefaultPriceScope()) {
85  $this->unsSelectionPriceValue();
86  $this->unsSelectionPriceType();
87  }
88  }
89  parent::afterSave();
90  }
91 }
$resource
Definition: bulk.php:12
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Catalog\Helper\Data $catalogData, \Magento\Bundle\Model\ResourceModel\Selection $resource, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
Definition: Selection.php:51