annotate core/modules/migrate/src/Event/EventBase.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\migrate\Event;
Chris@0 4
Chris@0 5 use Drupal\migrate\Plugin\MigrationInterface;
Chris@0 6 use Drupal\migrate\MigrateMessageInterface;
Chris@0 7 use Symfony\Component\EventDispatcher\Event as SymfonyEvent;
Chris@0 8
Chris@0 9 class EventBase extends SymfonyEvent {
Chris@0 10
Chris@0 11 /**
Chris@0 12 * The migration.
Chris@0 13 *
Chris@0 14 * @var \Drupal\migrate\Plugin\MigrationInterface
Chris@0 15 */
Chris@0 16 protected $migration;
Chris@0 17
Chris@0 18 /**
Chris@0 19 * The current message service.
Chris@0 20 *
Chris@0 21 * @var \Drupal\migrate\MigrateMessageInterface
Chris@0 22 */
Chris@0 23 protected $message;
Chris@0 24
Chris@0 25 /**
Chris@0 26 * Constructs a Migrate event object.
Chris@0 27 *
Chris@0 28 * @param \Drupal\migrate\Plugin\MigrationInterface $migration
Chris@0 29 * The migration being run.
Chris@0 30 * @param \Drupal\migrate\MigrateMessageInterface $message
Chris@0 31 * The Migrate message service.
Chris@0 32 */
Chris@0 33 public function __construct(MigrationInterface $migration, MigrateMessageInterface $message) {
Chris@0 34 $this->migration = $migration;
Chris@0 35 $this->message = $message;
Chris@0 36 }
Chris@0 37
Chris@0 38 /**
Chris@0 39 * Gets the migration.
Chris@0 40 *
Chris@0 41 * @return \Drupal\migrate\Plugin\MigrationInterface
Chris@0 42 * The migration being run.
Chris@0 43 */
Chris@0 44 public function getMigration() {
Chris@0 45 return $this->migration;
Chris@0 46 }
Chris@0 47
Chris@0 48 /**
Chris@0 49 * Logs a message using the Migrate message service.
Chris@0 50 *
Chris@0 51 * @param string $message
Chris@0 52 * The message to log.
Chris@0 53 * @param string $type
Chris@0 54 * The type of message, for example: status or warning.
Chris@0 55 */
Chris@0 56 public function logMessage($message, $type = 'status') {
Chris@0 57 $this->message->display($message, $type);
Chris@0 58 }
Chris@0 59
Chris@0 60 }