You are here

class VemCommands in Video Embed Field 8.2

A Drush commandfile.

In addition to this file, you need a drush.services.yml in root of your module, and a composer.json file that provides the name of the services file to use.

See these files for an example of injecting Drupal services:

Hierarchy

  • class \Drupal\vem_migrate_oembed\Commands\VemCommands extends \Drush\Commands\DrushCommands

Expanded class hierarchy of VemCommands

1 string reference to 'VemCommands'
drush.services.yml in modules/video_embed_media/modules/vem_migrate_oembed/drush.services.yml
modules/video_embed_media/modules/vem_migrate_oembed/drush.services.yml
1 service uses VemCommands
vem_migrate_oembed.commands in modules/video_embed_media/modules/vem_migrate_oembed/drush.services.yml
\Drupal\vem_migrate_oembed\Commands\VemCommands

File

modules/video_embed_media/modules/vem_migrate_oembed/src/Commands/VemCommands.php, line 19

Namespace

Drupal\vem_migrate_oembed\Commands
View source
class VemCommands extends DrushCommands {

  /**
   * The migrate service.
   *
   * @var \Drupal\vem_migrate_oembed\VemMigrate
   */
  protected $migrator;

  /**
   * VemCommands constructor.
   *
   * @param \Drupal\vem_migrate_oembed\VemMigrate $migrator
   *   The migrate service.
   */
  public function __construct(VemMigrate $migrator) {
    parent::__construct();
    $this->migrator = $migrator;
  }

  /**
   * Migrates from VEF to core media.
   *
   * @usage drush vemmo
   *   Migrates from VEF to core media.
   *
   * @command vem:migrate_oembed
   * @aliases vemmo
   */
  public function migrate() {
    $this->migrator
      ->migrate();
    $this
      ->io()
      ->success(\dt('Migration complete.'));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
VemCommands::$migrator protected property The migrate service.
VemCommands::migrate public function Migrates from VEF to core media.
VemCommands::__construct public function VemCommands constructor.