diff core/lib/Drupal/Core/Command/DbDumpApplication.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/lib/Drupal/Core/Command/DbDumpApplication.php	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,43 @@
+<?php
+
+namespace Drupal\Core\Command;
+
+use Symfony\Component\Console\Application;
+use Symfony\Component\Console\Input\InputInterface;
+
+/**
+ * Provides a command to dump a database generation script.
+ */
+class DbDumpApplication extends Application {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getCommandName(InputInterface $input) {
+    return 'dump-database-d8-mysql';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getDefaultCommands() {
+    // Even though this is a single command, keep the HelpCommand (--help).
+    $default_commands = parent::getDefaultCommands();
+    $default_commands[] = new DbDumpCommand();
+    return $default_commands;
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * Overridden so the application doesn't expect the command name as the first
+   * argument.
+   */
+  public function getDefinition() {
+    $definition = parent::getDefinition();
+    // Clears the normal first argument (the command name).
+    $definition->setArguments();
+    return $definition;
+  }
+
+}