Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
rebuildAllAssignmentsCount example
'success' => true,
'total' =>
$count
,
]
)
;
}
public
function
prepareTreeAction
(
)
{
$component
=
Shopware
(
)
->
Container
(
)
->
get
(
'categorydenormalization'
)
;
$component
->
removeOrphanedAssignments
(
)
;
$count
=
$component
->
rebuildAllAssignmentsCount
(
)
;
$this
->
View
(
)
->
assign
(
[
'success' => true,
'data' =>
[
'count' =>
$count
]
,
]
)
;
}
/** * Calculates the number of all urls to create a cache entry for */
public
function
getHttpURLsAction
(
)
{
if
(
$progress
=== 0
)
{
$output
->
writeln
(
'Removing orphans'
)
;
$component
->
removeOrphanedAssignments
(
)
;
$output
->
writeln
(
'Rebuild path info'
)
;
$component
->
rebuildCategoryPath
(
)
;
$output
->
writeln
(
'Removing assignments'
)
;
$component
->
removeAllAssignments
(
)
;
}
// Get total number of assignments to build
$output
->
write
(
'Counting…'
)
;
$count
=
$component
->
rebuildAllAssignmentsCount
(
)
;
$output
->
writeln
(
"\rCounted {
$count
}
items"
)
;
$progressHelper
=
new
ProgressBar
(
$output
,
$count
)
;
$progressHelper
->
setFormat
(
' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%'
)
;
// create the assignments
while
(
$progress
<
$count
)
{
$component
->
rebuildAllAssignments
(
$limit
,
$progress
)
;
$progress
+=
$limit
;
$progressHelper
->
advance
(
)
;
}