Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
validateThemeAssignment example
$this
->
recompileThemesIfNecessary
(
$config
,
$context
,
$configurationCollection
,
$themeId
)
;
}
public
function
handleThemeUninstall
(
StorefrontPluginConfiguration
$config
, Context
$context
)
: void
{
$themeId
= null;
if
(
$config
->
getIsTheme
(
)
)
{
$themeData
=
$this
->
getThemeDataByTechnicalName
(
$config
->
getTechnicalName
(
)
)
;
$themeId
=
$themeData
->
getId
(
)
;
// throw an exception if theme is still assigned to a sales channel
$this
->
validateThemeAssignment
(
$themeId
)
;
// set active = false in the database to theme and all children
$this
->
changeThemeActive
(
$themeData
, false,
$context
)
;
}
$configs
=
$this
->storefrontPluginRegistry->
getConfigurations
(
)
;
$configs
=
$configs
->
filter
(
fn
(
StorefrontPluginConfiguration
$registeredConfig
)
: bool =>
$registeredConfig
->
getTechnicalName
(
)
!==
$config
->
getTechnicalName
(
)
)
;
$this
->
recompileThemesIfNecessary
(
$config
,
$context
,
$configs
,
$themeId
)
;
}