27 \Magento\Framework\DataObject\IdentityInterface,
130 private $_isReadOnly =
false;
182 \
Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
190 \
Magento\Directory\Model\CurrencyFactory $currencyFactory,
204 $this->_configDataResource = $configDataResource;
205 $this->_coreConfig = $coreConfig;
207 $this->_storeGroupFactory = $storeGroupFactory;
208 $this->_websiteFactory = $websiteFactory;
210 $this->_currencyFactory = $currencyFactory;
232 if (!is_numeric(
$id) && $field ===
null) {
236 return parent::load(
$id, $field);
247 if (!isset($this->_configCache[
$path])) {
248 $config = $this->_coreConfig->getValue(
258 return $this->_configCache[
$path];
269 $this->_groupsCount = 0;
274 $this->_defaultGroup =
$group;
276 $this->_groupsCount++;
289 $this->_groupsCount = 0;
290 foreach ($groups as
$group) {
294 $this->_defaultGroup =
$group;
296 $this->_groupsCount++;
308 return $this->_storeGroupFactory->create()->getCollection()->addWebsiteFilter($this->
getId())
309 ->setLoadDefault(
true);
319 if ($this->_groups ===
null) {
332 if ($this->_groups ===
null) {
345 if ($this->_groups ===
null) {
358 if (!$this->hasDefaultGroupId()) {
361 if ($this->_groups ===
null) {
375 $this->_storesCount = 0;
379 $this->_storeCodes[
$store->getId()] =
$store->getCode();
381 $this->_defaultStore =
$store;
383 $this->_storesCount++;
396 $this->_storesCount = 0;
400 $this->_storeCodes[
$store->getId()] =
$store->getCode();
402 $this->_defaultStore =
$store;
404 $this->_storesCount++;
415 return $this->storeListFactory->create()->addWebsiteFilter($this->
getId())->setLoadDefault(
true);
425 if ($this->_stores ===
null) {
438 if ($this->_stores ===
null) {
451 if ($this->_stores ===
null) {
464 if ($this->_stores ===
null) {
477 if ($this->_isReadOnly || !$this->
getId()) {
480 if ($this->_isCanDelete ===
null) {
481 $this->_isCanDelete = $this->_websiteFactory->create()->getCollection()->getSize() > 1 &&
482 !$this->getIsDefault();
494 return implode(
'-', [$this->getWebsiteId(), $this->getGroupId(), $this->getStoreId()]);
502 return $this->
_getData(
'default_group_id');
550 $this->_configDataResource->clearScopeData(
554 $this->_configDataResource->clearScopeData(
558 return parent::beforeDelete();
568 $this->_storeManager->reinitStores();
569 parent::afterDelete();
582 $this->_storeManager->reinitStores();
585 return parent::afterSave();
599 $currencyCode = $this->_coreConfig->getValue(
607 return $currencyCode;
617 $currency = $this->
getData(
'base_currency');
618 if ($currency ===
null) {
620 $this->
setData(
'base_currency', $currency);
646 return $this->
getResource()->getDefaultStoresSelect($withDefault);
658 $this->_isReadOnly = (bool)
$value;
660 return $this->_isReadOnly;
679 return \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE;
_getExtensionAttributes()
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
setDefaultGroupId($defaultGroupId)
const XML_PATH_CURRENCY_BASE
getDefaultStoresSelect($withDefault=false)
const XML_PATH_PRICE_SCOPE
getData($key='', $index=null)
setData($key, $value=null)
setExtensionAttributes(\Magento\Store\Api\Data\WebsiteExtensionInterface $extensionAttributes)
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Config\Model\ResourceModel\Config\Data $configDataResource, \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig, \Magento\Store\Model\ResourceModel\Store\CollectionFactory $storeListFactory, \Magento\Store\Model\GroupFactory $storeGroupFactory, \Magento\Store\Model\WebsiteFactory $websiteFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
if(!isset($_GET['name'])) $name