Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
arrayGetPath example
/** @var Mail $mail */
$mail
=
$this
->
getRepository
(
)
->
find
(
(int)
$this
->
Request
(
)
->
getParam
(
'mailId'
)
)
;
$shop
=
$this
->
get
(
ModelManager::
class
)
->
getRepository
(
Shop::
class
)
->
getActiveDefault
(
)
;
$shop
->
registerResources
(
)
;
$context
=
array_merge
(
$this
->
getDefaultMailContext
(
$shop
)
,
$mail
->
getContext
(
)
)
;
$completer
=
$this
->container->
get
(
AutoCompleteResolver::
class
)
;
$context
=
$completer
->
completer
(
$context
,
$this
->
Request
(
)
->
getParam
(
'smartyCode'
)
)
;
$context
=
$mail
->
arrayGetPath
(
$context
)
;
$result
=
[
]
;
foreach
(
$context
as
$key
=>
$value
)
{
if
(
strpos
(
$key
,
$prefix
)
!== false || !
$prefix
)
{
$result
[
]
=
[
'word' => '$' .
$key
, 'value' => \
is_array
(
$value
)
? 'Array' :
(string)
$value
]
;
}
}
$this
->
View
(
)
->
assign
(
'data',
$result
)
;
$this
->
View
(
)
->
assign
(
'success', true
)
;
}