Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getWordIndex example
$repository
=
$this
->
getContainer
(
)
->
get
(
ModelManager::
class
)
->
getRepository
(
Plugin::
class
)
;
$queryBuilder
=
$repository
->
createQueryBuilder
(
'plugin'
)
;
$result
=
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
(
)
->
eq
(
'plugin.capabilityEnable', 'true'
)
)
->
select
(
[
'plugin.name'
]
)
->
getQuery
(
)
->
getArrayResult
(
)
;
return
array_column
(
$result
, 'name'
)
;
}
if
(
$argumentName
=== 'key'
)
{
$pluginName
=
$context
->
getWordAtIndex
(
$context
->
getWordIndex
(
)
- 1
)
;
$pluginManager
=
$this
->container->
get
(
InstallerService::
class
)
;
try
{
$plugin
=
$pluginManager
->
getPluginByName
(
$pluginName
)
;
}
catch
(
Exception
$e
)
{
return
[
]
;
}
$shopRepository
=
$this
->
getContainer
(
)
->
get
(
ModelManager::
class
)
->
getRepository
(
Shop::
class
)
;
$shops
=
$shopRepository
->
findAll
(
)
;