Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
makeQueryVersionAware example
private
function
getChildren
(
array
$parent
, EntityDefinition
$definition
, Context
$context
)
: array
{
$query
=
$this
->connection->
createQueryBuilder
(
)
;
$escaped
= EntityDefinitionQueryHelper::
escape
(
$definition
->
getEntityName
(
)
)
;
$query
->
from
(
$escaped
)
;
$query
->
select
(
$this
->
getFieldsToSelect
(
$definition
)
)
;
$query
->
andWhere
(
'parent_id = :id'
)
;
$query
->
setParameter
(
'id',
$parent
[
'id'
]
)
;
$this
->
makeQueryVersionAware
(
$definition
, Uuid::
fromHexToBytes
(
$context
->
getVersionId
(
)
)
,
$query
)
;
return
$query
->
executeQuery
(
)
->
fetchAllAssociative
(
)
;
}
private
function
updateTree
(
array
$entity
, EntityDefinition
$definition
, Context
$context
)
: string
{
$query
=
$this
->connection->
createQueryBuilder
(
)
;
$escaped
= EntityDefinitionQueryHelper::
escape
(
$definition
->
getEntityName
(
)
)
;
$query
->
update
(
$escaped
)
;
/** @var TreePathField $pathField */