function GenerateCommandTrait::processBatch
Runs the batch that a plugin has set, if any, in this process.
1 call to GenerateCommandTrait::processBatch()
- GenerateCommandTrait::generate in devel_generate/
src/ Command/ GenerateCommandTrait.php - Generates with the given plugin, from the command's arguments and options.
File
-
devel_generate/
src/ Command/ GenerateCommandTrait.php, line 65
Class
- GenerateCommandTrait
- Runs a DevelGenerate plugin from a console command.
Namespace
Drupal\devel_generate\CommandCode
protected function processBatch() : void {
$batch =& batch_get();
if (empty($batch)) {
return;
}
// Run all the operations now, instead of redirecting to the batch page.
$batch['progressive'] = FALSE;
// batch_process() builds a URL from the current route. A command line
// request has none, so give it a placeholder.
$request = $this->requestStack
->getCurrentRequest();
if ($request && !$request->attributes
->has(RouteObjectInterface::ROUTE_OBJECT)) {
$request->attributes
->set(RouteObjectInterface::ROUTE_OBJECT, new Route('<none>'));
$request->attributes
->set(RouteObjectInterface::ROUTE_NAME, '<none>');
}
batch_process();
}