public function Manager::queueBatch in Taxonomy Term Depth 8
Same name and namespace in other branches
- 8.2 src/QueueManager/Manager.php \Drupal\taxonomy_term_depth\QueueManager\Manager::queueBatch()
1 call to Manager::queueBatch()
- Manager::queueBatchMissing in src/
QueueManager/ Manager.php
File
- src/
QueueManager/ Manager.php, line 47 - Manages queue operations.
Class
Namespace
Drupal\taxonomy_term_depth\QueueManagerCode
public function queueBatch($queue_all = TRUE) {
$query = $this
->getTermsQuery();
if (!$queue_all) {
$query
->condition((new Condition())
->condition('td.depth_level', '', 'IS NULL')
->condition('td.depth', '', 'IS NULL'));
}
else {
// Delete queue if have one.
$this
->clear();
}
$ids = [];
foreach ($query
->execute() as $row) {
if (count($ids) >= static::BATCH_COUNT) {
$this
->queueByIds($ids);
$ids = [];
}
$ids[] = $row->tid;
}
// Queue remaining items.
$this
->queueByIds($ids);
return TRUE;
}