Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createEntitySearchQuery example
public
function
searchAction
(
)
{
$entity
=
$this
->
Request
(
)
->
getParam
(
'entity'
)
;
$ids
=
$this
->
Request
(
)
->
getParam
(
'ids',
[
]
)
;
$id
=
$this
->
Request
(
)
->
getParam
(
'id'
)
;
$term
=
$this
->
Request
(
)
->
getParam
(
'query'
)
;
$offset
=
$this
->
Request
(
)
->
getParam
(
'start', 0
)
;
$limit
=
$this
->
Request
(
)
->
getParam
(
'limit', 20
)
;
$builder
=
$this
->
createEntitySearchQuery
(
$entity
)
;
if
(
!
empty
(
$ids
)
)
{
$ids
=
json_decode
(
$ids
, true
)
;
$this
->
addIdsCondition
(
$builder
,
$ids
)
;
}
elseif
(
!
empty
(
$id
)
)
{
$this
->
addIdsCondition
(
$builder
,
[
$id
]
)
;
}
else
{
if
(
!
empty
(
$term
)
)
{
$this
->
addSearchTermCondition
(
$entity
,
$builder
,
$term
)
;
}