5
5
*/
6
6
namespace Magento \Store \Model ;
7
7
8
+ use Magento \Config \Model \ResourceModel \Config \Data ;
9
+ use Magento \Directory \Model \CurrencyFactory ;
10
+ use Magento \Framework \Api \AttributeValueFactory ;
11
+ use Magento \Framework \Api \ExtensionAttributesFactory ;
12
+ use Magento \Framework \App \Cache \Type \Config ;
13
+ use Magento \Framework \App \Cache \TypeListInterface ;
14
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
15
+ use Magento \Framework \App \ObjectManager ;
16
+ use Magento \Framework \Data \Collection \AbstractDb ;
17
+ use Magento \Framework \MessageQueue \PoisonPill \PoisonPillPutInterface ;
18
+ use Magento \Framework \Model \Context ;
19
+ use Magento \Framework \Model \ResourceModel \AbstractResource ;
20
+ use Magento \Framework \Registry ;
21
+ use Magento \PageCache \Model \Cache \Type ;
22
+ use Magento \Store \Model \ResourceModel \Store \CollectionFactory ;
23
+
8
24
/**
9
25
* Core Website model
10
26
*
@@ -160,7 +176,7 @@ class Website extends \Magento\Framework\Model\AbstractExtensibleModel implement
160
176
protected $ _currencyFactory ;
161
177
162
178
/**
163
- * @var \Magento\Framework\MessageQueue\PoisonPill\ PoisonPillPutInterface
179
+ * @var PoisonPillPutInterface
164
180
*/
165
181
private $ pillPut ;
166
182
@@ -170,21 +186,27 @@ class Website extends \Magento\Framework\Model\AbstractExtensibleModel implement
170
186
private $ _coreConfig ;
171
187
172
188
/**
173
- * @param \Magento\Framework\Model\Context $context
174
- * @param \Magento\Framework\Registry $registry
175
- * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
176
- * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
177
- * @param \Magento\Config\Model\ResourceModel\Config\Data $configDataResource
178
- * @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig
179
- * @param \Magento\Store\Model\ResourceModel\Store\CollectionFactory $storeListFactory
180
- * @param \Magento\Store\Model\GroupFactory $storeGroupFactory
181
- * @param \Magento\Store\Model\WebsiteFactory $websiteFactory
182
- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
183
- * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
184
- * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
185
- * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
189
+ * @var TypeListInterface
190
+ */
191
+ private TypeListInterface $ typeList ;
192
+
193
+ /**
194
+ * @param Context $context
195
+ * @param Registry $registry
196
+ * @param ExtensionAttributesFactory $extensionFactory
197
+ * @param AttributeValueFactory $customAttributeFactory
198
+ * @param Data $configDataResource
199
+ * @param ScopeConfigInterface $coreConfig
200
+ * @param CollectionFactory $storeListFactory
201
+ * @param GroupFactory $storeGroupFactory
202
+ * @param WebsiteFactory $websiteFactory
203
+ * @param StoreManagerInterface $storeManager
204
+ * @param CurrencyFactory $currencyFactory
205
+ * @param AbstractResource|null $resource
206
+ * @param AbstractDb|null $resourceCollection
186
207
* @param array $data
187
- * @param \Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface|null $pillPut
208
+ * @param PoisonPillPutInterface|null $pillPut
209
+ * @param TypeListInterface|null $typeList
188
210
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
189
211
*/
190
212
public function __construct (
@@ -202,7 +224,8 @@ public function __construct(
202
224
\Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
203
225
\Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
204
226
array $ data = [],
205
- \Magento \Framework \MessageQueue \PoisonPill \PoisonPillPutInterface $ pillPut = null
227
+ PoisonPillPutInterface $ pillPut = null ,
228
+ TypeListInterface $ typeList = null
206
229
) {
207
230
parent ::__construct (
208
231
$ context ,
@@ -220,8 +243,8 @@ public function __construct(
220
243
$ this ->_websiteFactory = $ websiteFactory ;
221
244
$ this ->_storeManager = $ storeManager ;
222
245
$ this ->_currencyFactory = $ currencyFactory ;
223
- $ this ->pillPut = $ pillPut ?: \ Magento \ Framework \ App \ ObjectManager::getInstance ()
224
- ->get (\ Magento \ Framework \ MessageQueue \ PoisonPill \PoisonPillPutInterface ::class);
246
+ $ this ->pillPut = $ pillPut ?: ObjectManager::getInstance ()-> get (PoisonPillPutInterface::class);
247
+ $ this -> typeList = $ typeList ?: ObjectManager:: getInstance () ->get (TypeListInterface ::class);
225
248
}
226
249
227
250
/**
@@ -584,6 +607,13 @@ public function beforeDelete()
584
607
public function afterDelete ()
585
608
{
586
609
$ this ->_storeManager ->reinitStores ();
610
+ $ types = [
611
+ Type::TYPE_IDENTIFIER ,
612
+ Config::TYPE_IDENTIFIER
613
+ ];
614
+ foreach ($ types as $ type ) {
615
+ $ this ->typeList ->cleanType ($ type );
616
+ }
587
617
parent ::afterDelete ();
588
618
return $ this ;
589
619
}
@@ -598,6 +628,8 @@ public function afterSave()
598
628
{
599
629
if ($ this ->isObjectNew ()) {
600
630
$ this ->_storeManager ->reinitStores ();
631
+ } else {
632
+ $ this ->typeList ->invalidate ([Type::TYPE_IDENTIFIER , Config::TYPE_IDENTIFIER ]);
601
633
}
602
634
$ this ->pillPut ->put ();
603
635
return parent ::afterSave ();
0 commit comments