Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
PluginNotActivatedException example
public
function
deactivatePlugin
(
PluginEntity
$plugin
, Context
$shopwareContext
)
: DeactivateContext
{
if
(
$plugin
->
getInstalledAt
(
)
=== null
)
{
throw
new
PluginNotInstalledException
(
$plugin
->
getName
(
)
)
;
}
if
(
$plugin
->
getActive
(
)
=== false
)
{
throw
new
PluginNotActivatedException
(
$plugin
->
getName
(
)
)
;
}
$dependantPlugins
=
$this
->
getEntities
(
$this
->pluginCollection->
all
(
)
,
$shopwareContext
)
->
getEntities
(
)
->
getElements
(
)
;
$dependants
=
$this
->requirementValidator->
resolveActiveDependants
(
$plugin
,
$dependantPlugins
)
;
if
(
\
count
(
$dependants
)
> 0
)
{
throw
new
PluginHasActiveDependantsException
(
$plugin
->
getName
(
)
,
$dependants
)
;
}