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 \Store \Model \ResourceModel \Store \CollectionFactory ;
22+
823/**
924 * Core Website model
1025 *
@@ -28,9 +43,9 @@ class Website extends \Magento\Framework\Model\AbstractExtensibleModel implement
2843 \Magento \Framework \App \ScopeInterface,
2944 \Magento \Store \Api \Data \WebsiteInterface
3045{
31- const ENTITY = 'store_website ' ;
46+ public const ENTITY = 'store_website ' ;
3247
33- const CACHE_TAG = 'website ' ;
48+ public const CACHE_TAG = 'website ' ;
3449
3550 /**
3651 * @var bool
@@ -160,7 +175,7 @@ class Website extends \Magento\Framework\Model\AbstractExtensibleModel implement
160175 protected $ _currencyFactory ;
161176
162177 /**
163- * @var \Magento\Framework\MessageQueue\PoisonPill\ PoisonPillPutInterface
178+ * @var PoisonPillPutInterface
164179 */
165180 private $ pillPut ;
166181
@@ -170,21 +185,27 @@ class Website extends \Magento\Framework\Model\AbstractExtensibleModel implement
170185 private $ _coreConfig ;
171186
172187 /**
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
188+ * @var TypeListInterface
189+ */
190+ private TypeListInterface $ typeList ;
191+
192+ /**
193+ * @param Context $context
194+ * @param Registry $registry
195+ * @param ExtensionAttributesFactory $extensionFactory
196+ * @param AttributeValueFactory $customAttributeFactory
197+ * @param Data $configDataResource
198+ * @param ScopeConfigInterface $coreConfig
199+ * @param CollectionFactory $storeListFactory
200+ * @param GroupFactory $storeGroupFactory
201+ * @param WebsiteFactory $websiteFactory
202+ * @param StoreManagerInterface $storeManager
203+ * @param CurrencyFactory $currencyFactory
204+ * @param AbstractResource|null $resource
205+ * @param AbstractDb|null $resourceCollection
186206 * @param array $data
187- * @param \Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface|null $pillPut
207+ * @param PoisonPillPutInterface|null $pillPut
208+ * @param TypeListInterface|null $typeList
188209 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
189210 */
190211 public function __construct (
@@ -202,7 +223,8 @@ public function __construct(
202223 \Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
203224 \Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
204225 array $ data = [],
205- \Magento \Framework \MessageQueue \PoisonPill \PoisonPillPutInterface $ pillPut = null
226+ PoisonPillPutInterface $ pillPut = null ,
227+ TypeListInterface $ typeList = null
206228 ) {
207229 parent ::__construct (
208230 $ context ,
@@ -220,8 +242,8 @@ public function __construct(
220242 $ this ->_websiteFactory = $ websiteFactory ;
221243 $ this ->_storeManager = $ storeManager ;
222244 $ this ->_currencyFactory = $ currencyFactory ;
223- $ this ->pillPut = $ pillPut ?: \ Magento \ Framework \ App \ ObjectManager::getInstance ()
224- ->get (\ Magento \ Framework \ MessageQueue \ PoisonPill \PoisonPillPutInterface ::class);
245+ $ this ->pillPut = $ pillPut ?: ObjectManager::getInstance ()-> get (PoisonPillPutInterface::class);
246+ $ this -> typeList = $ typeList ?: ObjectManager:: getInstance () ->get (TypeListInterface ::class);
225247 }
226248
227249 /**
@@ -584,6 +606,13 @@ public function beforeDelete()
584606 public function afterDelete ()
585607 {
586608 $ this ->_storeManager ->reinitStores ();
609+ $ types = [
610+ 'full_page ' ,
611+ Config::TYPE_IDENTIFIER
612+ ];
613+ foreach ($ types as $ type ) {
614+ $ this ->typeList ->cleanType ($ type );
615+ }
587616 parent ::afterDelete ();
588617 return $ this ;
589618 }
@@ -598,6 +627,8 @@ public function afterSave()
598627 {
599628 if ($ this ->isObjectNew ()) {
600629 $ this ->_storeManager ->reinitStores ();
630+ } else {
631+ $ this ->typeList ->invalidate (['full_page ' , Config::TYPE_IDENTIFIER ]);
601632 }
602633 $ this ->pillPut ->put ();
603634 return parent ::afterSave ();
@@ -687,6 +718,17 @@ public function getIdentities()
687718 return [self ::CACHE_TAG ];
688719 }
689720
721+ /**
722+ * @inheritDoc
723+ */
724+ public function getCacheTags ()
725+ {
726+ $ identities = $ this ->getIdentities ();
727+ $ parentTags = parent ::getCacheTags ();
728+
729+ return array_unique (array_merge ($ identities , $ parentTags ));
730+ }
731+
690732 /**
691733 * @inheritdoc
692734 * @since 100.1.0
0 commit comments