Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
updateActions example
try
{
$this
->
assertAppSecretIsPresentForApplicableFeatures
(
$app
,
$manifest
)
;
}
catch
(
AppException
$e
)
{
$this
->
removeAppAndRole
(
$app
,
$context
)
;
throw
$e
;
}
$flowActions
=
$this
->appLoader->
getFlowActions
(
$app
)
;
if
(
$flowActions
)
{
$this
->flowBuilderActionPersister->
updateActions
(
$flowActions
,
$id
,
$context
,
$defaultLocale
)
;
}
$webhooks
=
$this
->
getWebhooks
(
$manifest
,
$flowActions
,
$id
,
$defaultLocale
,
(bool)
$app
->
getAppSecret
(
)
)
;
$context
->
scope
(
Context::SYSTEM_SCOPE,
function
DContext
$context
)
use
(
$webhooks
,
$id
)
: void
{
$this
->webhookPersister->
updateWebhooksFromArray
(
$webhooks
,
$id
,
$context
)
;
}
)
;
$flowEvents
=
$this
->appLoader->
getFlowEvents
(
$app
)
;
if
(
$flowEvents
)
{
$this
->flowEventPersister->
updateEvents
(
$flowEvents
,
$id
,
$context
,
$defaultLocale
)
;
}
$manifest
= Manifest::
createFromXmlFile
(
__DIR__ . '/_fixtures/withFlowActions/manifest.xml'
)
;
$this
->appLifecycle->
install
(
$manifest
, true,
$this
->context
)
;
$appId
=
$this
->
getAppId
(
)
;
static
::
assertIsString
(
$appId
)
;
$flowActions
=
$this
->
getAppFlowActions
(
$appId
)
;
static
::
assertIsArray
(
$flowActions
)
;
$flowAction
= Action::
createFromXmlFile
(
__DIR__ . '/_fixtures/withFlowActions/Resources/flow-action-v2.xml'
)
;
$flowActionPersister
=
$this
->
getContainer
(
)
->
get
(
FlowActionPersister::
class
)
;
$flowActionPersister
->
updateActions
(
$flowAction
,
$appId
,
$context
, 'en-GB'
)
;
$newFlowActions
=
$this
->
getAppFlowActions
(
$appId
)
;
static
::
assertIsArray
(
$newFlowActions
)
;
static
::
assertCount
(
2,
$newFlowActions
)
;
foreach
(
$flowActions
as
$action
)
{
static
::
assertContains
(
$action
[
'id'
]
, \
array_column
(
$newFlowActions
, 'id'
)
)
;
}
}
public
function
testRefreshFlowExtension
(
)
: void
{