Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getRootAliases example
foreach
(
$this
->
getEntities
(
)
as
$entity
)
{
if
(
\
in_array
(
(string)
current
(
$metadata
->
getIdentifierValues
(
$entity
)
)
,
$values
, true
)
)
{
$choices
[
]
=
$entity
;
}
}
return
$choices
;
}
$qb
=
clone
$this
->queryBuilder;
$alias
=
current
(
$qb
->
getRootAliases
(
)
)
;
$parameter
= 'ORMQueryBuilderLoader_getEntitiesByIds_'.
$identifier
;
$parameter
=
str_replace
(
'.', '_',
$parameter
)
;
$where
=
$qb
->
expr
(
)
->
in
(
$alias
.'.'.
$identifier
, ':'.
$parameter
)
;
// Guess type
$entity
=
current
(
$qb
->
getRootEntities
(
)
)
;
$metadata
=
$qb
->
getEntityManager
(
)
->
getClassMetadata
(
$entity
)
;
if
(
\
in_array
(
$type
=
$metadata
->
getTypeOfField
(
$identifier
)
,
[
'integer', 'bigint', 'smallint'
]
)
)
{
$parameterType
=
class_exists
(
ArrayParameterType::
class
)
? ArrayParameterType::INTEGER : Connection::PARAM_INT_ARRAY;
// Filter out non-integer values (e.g. ""). If we don't, some