Skip to content

Commit c95e2c8

Browse files
committed
ACPT-1572: Slow saving of stores/websites
1 parent 614356e commit c95e2c8

File tree

1 file changed

+10
-33
lines changed

1 file changed

+10
-33
lines changed

app/code/Magento/Store/Model/Group.php

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,8 @@
99
*/
1010
namespace Magento\Store\Model;
1111

12-
use Magento\Config\Model\ResourceModel\Config\Data;
13-
use Magento\Framework\Api\AttributeValueFactory;
14-
use Magento\Framework\Api\ExtensionAttributesFactory;
15-
use Magento\Framework\App\Cache\TypeListInterface;
1612
use Magento\Framework\App\ObjectManager;
17-
use Magento\Framework\Data\Collection\AbstractDb;
18-
use Magento\Framework\Event\ManagerInterface;
1913
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface;
20-
use Magento\Framework\Model\Context;
21-
use Magento\Framework\Model\ResourceModel\AbstractResource;
22-
use Magento\Framework\Registry;
23-
use Magento\PageCache\Model\Cache\Type;
24-
use Magento\Store\Model\ResourceModel\Store\CollectionFactory;
2514
use Magento\Store\Model\Validation\StoreValidator;
2615

2716
/**
@@ -126,25 +115,19 @@ class Group extends \Magento\Framework\Model\AbstractExtensibleModel implements
126115
private $modelValidator;
127116

128117
/**
129-
* @var TypeListInterface
130-
*/
131-
private TypeListInterface $typeList;
132-
133-
/**
134-
* @param Context $context
135-
* @param Registry $registry
136-
* @param ExtensionAttributesFactory $extensionFactory
137-
* @param AttributeValueFactory $customAttributeFactory
138-
* @param Data $configDataResource
139-
* @param CollectionFactory $storeListFactory
118+
* @param \Magento\Framework\Model\Context $context
119+
* @param \Magento\Framework\Registry $registry
120+
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
121+
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
122+
* @param \Magento\Config\Model\ResourceModel\Config\Data $configDataResource
123+
* @param ResourceModel\Store\CollectionFactory $storeListFactory
140124
* @param StoreManagerInterface $storeManager
141-
* @param AbstractResource|null $resource
142-
* @param AbstractDb|null $resourceCollection
125+
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
126+
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
143127
* @param array $data
144-
* @param ManagerInterface|null $eventManager
128+
* @param \Magento\Framework\Event\ManagerInterface|null $eventManager
145129
* @param PoisonPillPutInterface|null $pillPut
146130
* @param StoreValidator|null $modelValidator
147-
* @param TypeListInterface|null $typeList
148131
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
149132
*/
150133
public function __construct(
@@ -160,8 +143,7 @@ public function __construct(
160143
array $data = [],
161144
\Magento\Framework\Event\ManagerInterface $eventManager = null,
162145
PoisonPillPutInterface $pillPut = null,
163-
StoreValidator $modelValidator = null,
164-
TypeListInterface $typeList = null
146+
StoreValidator $modelValidator = null
165147
) {
166148
$this->_configDataResource = $configDataResource;
167149
$this->_storeListFactory = $storeListFactory;
@@ -181,7 +163,6 @@ public function __construct(
181163
$resourceCollection,
182164
$data
183165
);
184-
$this->typeList = $typeList ?: ObjectManager::getInstance()->get(TypeListInterface::class);
185166
}
186167

187168
/**
@@ -476,7 +457,6 @@ public function afterDelete()
476457
$this->_storeManager->reinitStores();
477458
$this->eventManager->dispatch($this->_eventPrefix . '_delete', ['group' => $group]);
478459
});
479-
$this->typeList->cleanType(Type::TYPE_IDENTIFIER);
480460
$result = parent::afterDelete();
481461

482462
if ($this->getId() === $this->getWebsite()->getDefaultGroupId()) {
@@ -504,9 +484,6 @@ public function afterSave()
504484
$this->_storeManager->reinitStores();
505485
$this->eventManager->dispatch($this->_eventPrefix . '_save', ['group' => $group]);
506486
});
507-
if (!$this->isObjectNew()) {
508-
$this->typeList->invalidate([Type::TYPE_IDENTIFIER]);
509-
}
510487
$this->pillPut->put();
511488
return parent::afterSave();
512489
}

0 commit comments

Comments
 (0)