Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getParameterType example
EntityDefinitionQueryHelper::
escape
(
$root
)
,
'(' .
$versionQuery
->
getSQL
(
)
. ')',
EntityDefinitionQueryHelper::
escape
(
$alias
)
,
str_replace
(
array_keys
(
$parameters
)
,
array_values
(
$parameters
)
,
'#source# = #alias#.#reference_column#',
)
,
)
;
foreach
(
$versionQuery
->
getParameters
(
)
as
$key
=>
$value
)
{
$query
->
setParameter
(
$key
,
$value
,
$query
->
getParameterType
(
$key
)
)
;
}
}
}
'(' .
$nested
->
getSQL
(
)
. ')',
self::
escape
(
$alias
)
,
str_replace
(
array_keys
(
$parameters
)
,
array_values
(
$parameters
)
,
'#root#.#source_column# = #alias#.`id`'
.
$this
->
buildVersionWhere
(
$definition
,
$first
)
)
)
;
foreach
(
$nested
->
getParameters
(
)
as
$key
=>
$value
)
{
$type
=
$nested
->
getParameterType
(
$key
)
;
$query
->
setParameter
(
$key
,
$value
,
$type
)
;
}
}
private
function
parseFilter
(
JoinGroup
$group
, EntityDefinition
$definition
, QueryBuilder
$query
, Context
$context
, string
$alias
)
: void
{
$filter
=
new
AndFilter
(
$group
->
getQueries
(
)
)
;
if
(
$group
->
getOperator
(
)
=== MultiFilter::CONNECTION_OR
)
{
$filter
=
new
OrFilter
(
$group
->
getQueries
(
)
)
;
}
$pk
= EntityDefinitionQueryHelper::
escape
(
$pk
)
;
$scoreQuery
->
addSelect
(
$escapedTable
. '.' .
$pk
)
;
$join
.= \
sprintf
(
'score_table.%s = %s.%s AND ',
$pk
,
$escapedTable
,
$pk
)
;
}
// Remove remaining AND
$join
=
substr
(
$join
, 0, -4
)
;
foreach
(
$scoreQuery
->
getParameters
(
)
as
$key
=>
$value
)
{
$query
->
setParameter
(
$key
,
$value
,
$scoreQuery
->
getParameterType
(
$key
)
)
;
}
$query
->
join
(
EntityDefinitionQueryHelper::
escape
(
$table
)
,
'(' .
$scoreQuery
->
getSQL
(
)
. ')',
'score_table',
$join
)
;
}
foreach
(
$aggregation
->
getFields
(
)
as
$fieldName
)
{
$wrapper
->
setParameter
(
'rootIds',
$bytes
, ArrayParameterType::STRING
)
;
$limit
=
$fieldCriteria
->
getOffset
(
)
+
$fieldCriteria
->
getLimit
(
)
;
$offset
=
$fieldCriteria
->
getOffset
(
)
+ 1;
$wrapper
->
setParameter
(
'limit',
$limit
)
;
$wrapper
->
setParameter
(
'offset',
$offset
)
;
foreach
(
$query
->
getParameters
(
)
as
$key
=>
$value
)
{
$type
=
$query
->
getParameterType
(
$key
)
;
$wrapper
->
setParameter
(
$key
,
$value
,
$type
)
;
}
// initials the cursor and loop counter, pdo do not allow to execute SET and SELECT in one statement
$this
->connection->
executeQuery
(
'SET @n = 0; SET @c = null;'
)
;
$rows
=
$wrapper
->
executeQuery
(
)
->
fetchAllAssociative
(
)
;
$grouped
=
[
]
;
foreach
(
$rows
as
$row
)
{
$id
=
(string)
$row
[
'id'
]
;