Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getScheduledEntityUpdates example
continue
;
}
$this
->queue
[
]
=
$backlog
;
}
// Entity Insertions
foreach
(
$uow
->
getScheduledEntityInsertions
(
)
as
$entity
)
{
$this
->inserts
[
]
=
$entity
;
}
// Entity updates
foreach
(
$uow
->
getScheduledEntityUpdates
(
)
as
$entity
)
{
$backlog
=
$this
->
getUpdateBacklog
(
$entity
)
;
if
(
!
$backlog
)
{
continue
;
}
$this
->queue
[
]
=
$backlog
;
}
}
public
function
postFlush
(
PostFlushEventArgs
$eventArgs
)
{
foreach
(
$this
->inserts
as
$entity
)
{
if
(
!
(
$category
instanceof Category
)
)
{
continue
;
}
$category
=
$this
->
setPathForCategory
(
$category
)
;
$md
=
$em
->
getClassMetadata
(
\
get_class
(
$category
)
)
;
$uow
->
recomputeSingleEntityChangeSet
(
$md
,
$category
)
;
}
// Entity updates
foreach
(
$uow
->
getScheduledEntityUpdates
(
)
as
$category
)
{
if
(
!
(
$category
instanceof Category
)
)
{
continue
;
}
$changeSet
=
$uow
->
getEntityChangeSet
(
$category
)
;
if
(
!
isset
(
$changeSet
[
'parent'
]
)
)
{
continue
;
}
$oldParentCategory
=
$changeSet
[
'parent'
]
[
0
]
;
// Entity Insertions
foreach
(
$uow
->
getScheduledEntityInsertions
(
)
as
$entity
)
{
$backlog
=
$this
->
getBacklog
(
$entity
)
;
if
(
!
$backlog
||
$backlog
->entity_id === null
)
{
continue
;
}
$queue
[
$this
->
getBacklogKey
(
$backlog
)
]
=
$backlog
;
}
// Entity updates
foreach
(
$uow
->
getScheduledEntityUpdates
(
)
as
$entity
)
{
$backlog
=
$this
->
getBacklog
(
$entity
)
;
if
(
!
$backlog
)
{
continue
;
}
$queue
[
$this
->
getBacklogKey
(
$backlog
)
]
=
$backlog
;
}
$this
->container->
get
(
'shopware_bundle_es_backend.backlog_service'
)
->
write
(
array_values
(
$queue
)
)
;
}
}