Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getScalarResult example
$productFeedRepository
=
$this
->container->
get
(
ModelManager::
class
)
->
getRepository
(
ProductFeed::
class
)
;
$queryBuilder
=
$productFeedRepository
->
createQueryBuilder
(
'feed'
)
;
if
(
!
empty
(
$context
->
getCurrentWord
(
)
)
)
{
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
(
)
->
like
(
'feed.id', ':id'
)
)
->
setParameter
(
'id',
addcslashes
(
$context
->
getCurrentWord
(
)
, '%_'
)
. '%'
)
;
}
$result
=
$queryBuilder
->
select
(
[
'feed.id'
]
)
->
addOrderBy
(
$queryBuilder
->
expr
(
)
->
asc
(
'feed.id'
)
)
->
getQuery
(
)
->
getScalarResult
(
)
;
return
array_column
(
$result
, 'id'
)
;
}
return
[
]
;
}
/** * {@inheritdoc} */
public
function
completeArgumentValues
(
$argumentName
, CompletionContext
$context
)
{