protected function DbDumpCommand::execute

protected DbDumpCommand::execute(InputInterface $input, OutputInterface $output)

Executes the current command.

This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.

Parameters

InputInterface $input An InputInterface instance:

OutputInterface $output An OutputInterface instance:

Return value

null|int null or 0 if everything went fine, or an error code

Throws

LogicException When this abstract method is not implemented

Overrides Command::execute

See also

setCode()

File

core/lib/Drupal/Core/Command/DbDumpCommand.php, line 51

Class

DbDumpCommand
Provides a command to dump the current database to a script.

Namespace

Drupal\Core\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) {
  $connection = $this->getDatabaseConnection($input);

  // If not explicitly set, disable ANSI which will break generated php.
  if ($input->hasParameterOption(['--ansi']) !== TRUE) {
    $output->setDecorated(FALSE);
  }

  $schema_tables = $input->getOption('schema-only');
  $schema_tables = explode(',', $schema_tables);

  $output->writeln($this->generateScript($connection, $schema_tables), OutputInterface::OUTPUT_RAW);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Command!DbDumpCommand.php/function/DbDumpCommand::execute/8.1.x