20 \Magento\Framework\DataObject\IdentityInterface,
81 private $_isReadOnly =
false;
101 private $eventManager;
120 \
Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
128 \
Magento\Framework\Event\ManagerInterface $eventManager =
null 130 $this->_configDataResource = $configDataResource;
131 $this->_storeListFactory = $storeListFactory;
134 ->get(\
Magento\Framework\Event\ManagerInterface::class);
164 $this->_storesCount = 0;
168 $this->_storeCodes[
$store->getId()] =
$store->getCode();
170 $this->_defaultStore =
$store;
172 $this->_storesCount++;
185 $this->_storesCount = 0;
189 $this->_storeCodes[
$store->getId()] =
$store->getCode();
191 $this->_defaultStore =
$store;
193 $this->_storesCount++;
204 return $this->_storeListFactory->create()->addGroupFilter($this->
getId());
214 if ($this->_stores ===
null) {
227 if ($this->_stores ===
null) {
240 if ($this->_stores ===
null) {
251 if ($this->_stores ===
null) {
264 if (!$this->hasDefaultStoreId()) {
267 if ($this->_stores ===
null) {
306 if (
$store->getLocaleCode() == $locale) {
334 return $this->_storeManager->getWebsite($this->
getWebsiteId());
344 if (!$this->
getId()) {
348 return $this->
getWebsite()->getGroupsCount() > 1;
356 return $this->
_getData(
'default_store_id');
364 return $this->
setData(
'default_store_id', $defaultStoreId);
372 return $this->
_getData(
'root_category_id');
388 return $this->
_getData(
'website_id');
404 $this->_configDataResource->clearScopeData(
408 return parent::beforeDelete();
419 $this->_storeManager->reinitStores();
420 $this->eventManager->dispatch($this->_eventPrefix .
'_delete', [
'group' =>
$group]);
422 $result = parent::afterDelete();
426 if (!empty($ids) && count($ids) > 1) {
427 unset($ids[$this->
getId()]);
428 $defaultId = current($ids);
432 $this->
getWebsite()->setDefaultGroupId($defaultId);
446 $this->_storeManager->reinitStores();
447 $this->eventManager->dispatch($this->_eventPrefix .
'_save', [
'group' =>
$group]);
449 return parent::afterSave();
461 $this->_isReadOnly = (bool)
$value;
463 return $this->_isReadOnly;
_getExtensionAttributes()
setWebsite(Website $website)
getStoresByLocale($locale)
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
setRootCategoryId($rootCategoryId)
__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\Store\Model\ResourceModel\Store\CollectionFactory $storeListFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], \Magento\Framework\Event\ManagerInterface $eventManager=null)
getDefaultStoreByLocale($locale)
getData($key='', $index=null)
setData($key, $value=null)
setExtensionAttributes(\Magento\Store\Api\Data\GroupExtensionInterface $extensionAttributes)
setDefaultStoreId($defaultStoreId)
if(!isset($_GET['name'])) $name