Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
invalidateDetailRoute example
$this
->tags =
array_values
(
$event
->
getKeys
(
)
)
;
}
}
;
$eventDispatcher
->
addListener
(
InvalidateCacheEvent::
class
,
$listener
)
;
foreach
(
$scenarios
as
$scenario
)
{
/** @var list<string> $productsIds */
$productsIds
=
array_map
(
fn
(
string
$product
)
=>
$this
->ids->
get
(
$product
)
,
$scenario
[
'invalidate'
]
)
;
$this
->subscriber->
invalidateDetailRoute
(
new
ProductNoLongerAvailableEvent
(
$productsIds
,
Context::
createDefaultContext
(
)
)
)
;
static
::
assertSame
(
array_map
(
fn
(
string
$product
)
=> 'product-detail-route-' .
$this
->ids->
get
(
$product
)
,
$scenario
[
'expected'
]
)
,
$listener
->tags
)
;
}
}