55 */
66namespace Magento \Store \Model ;
77
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+
824/**
925 * Core Website model
1026 *
@@ -160,7 +176,7 @@ class Website extends \Magento\Framework\Model\AbstractExtensibleModel implement
160176 protected $ _currencyFactory ;
161177
162178 /**
163- * @var \Magento\Framework\MessageQueue\PoisonPill\ PoisonPillPutInterface
179+ * @var PoisonPillPutInterface
164180 */
165181 private $ pillPut ;
166182
@@ -170,21 +186,27 @@ class Website extends \Magento\Framework\Model\AbstractExtensibleModel implement
170186 private $ _coreConfig ;
171187
172188 /**
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
186207 * @param array $data
187- * @param \Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface|null $pillPut
208+ * @param PoisonPillPutInterface|null $pillPut
209+ * @param TypeListInterface|null $typeList
188210 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
189211 */
190212 public function __construct (
@@ -202,7 +224,8 @@ public function __construct(
202224 \Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
203225 \Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
204226 array $ data = [],
205- \Magento \Framework \MessageQueue \PoisonPill \PoisonPillPutInterface $ pillPut = null
227+ PoisonPillPutInterface $ pillPut = null ,
228+ TypeListInterface $ typeList = null
206229 ) {
207230 parent ::__construct (
208231 $ context ,
@@ -220,8 +243,8 @@ public function __construct(
220243 $ this ->_websiteFactory = $ websiteFactory ;
221244 $ this ->_storeManager = $ storeManager ;
222245 $ 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);
225248 }
226249
227250 /**
@@ -584,6 +607,13 @@ public function beforeDelete()
584607 public function afterDelete ()
585608 {
586609 $ 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+ }
587617 parent ::afterDelete ();
588618 return $ this ;
589619 }
@@ -598,6 +628,8 @@ public function afterSave()
598628 {
599629 if ($ this ->isObjectNew ()) {
600630 $ this ->_storeManager ->reinitStores ();
631+ } else {
632+ $ this ->typeList ->invalidate ([Type::TYPE_IDENTIFIER , Config::TYPE_IDENTIFIER ]);
601633 }
602634 $ this ->pillPut ->put ();
603635 return parent ::afterSave ();
0 commit comments