Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / src / Commands / generate / Generators / Migrate / MigrationGenerator.php
diff --git a/vendor/drush/drush/src/Commands/generate/Generators/Migrate/MigrationGenerator.php b/vendor/drush/drush/src/Commands/generate/Generators/Migrate/MigrationGenerator.php
new file mode 100644 (file)
index 0000000..a7ac4ec
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+namespace Drush\Commands\generate\Generators\Migrate;
+
+use DrupalCodeGenerator\Command\BaseGenerator;
+use DrupalCodeGenerator\Utils;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Question\Question;
+
+/**
+ * Implements `generate migration` command.
+ */
+class MigrationGenerator extends BaseGenerator
+{
+
+    protected $name = 'migration';
+    protected $description = 'Generates the yml and PHP class for a Migration';
+    protected $templatePath = __DIR__;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function interact(InputInterface $input, OutputInterface $output)
+    {
+        $questions = Utils::defaultPluginQuestions() + [
+            'migration_group' => new Question('Migration group', 'default'),
+            'destination_plugin' => new Question('Destination plugin', 'entity:node'),
+        ];
+
+        $vars = &$this->collectVars($input, $output, $questions);
+        $vars['class'] = Utils::camelize($vars['plugin_label']);
+
+        $this->addFile()
+            ->path('src/Plugin/migrate/source/{class}.php')
+            ->template('migration.twig');
+
+        $this->addFile()
+            ->path('config/install/migrate_plus.migration.{plugin_id}.yml')
+            ->template('migration.yml.twig');
+    }
+}