class MigrateIdMapMessageEvent

Same name in other branches
  1. 8.9.x core/modules/migrate/src/Event/MigrateIdMapMessageEvent.php \Drupal\migrate\Event\MigrateIdMapMessageEvent
  2. 10 core/modules/migrate/src/Event/MigrateIdMapMessageEvent.php \Drupal\migrate\Event\MigrateIdMapMessageEvent
  3. 11.x core/modules/migrate/src/Event/MigrateIdMapMessageEvent.php \Drupal\migrate\Event\MigrateIdMapMessageEvent

Wraps an ID map message event for event listeners.

Hierarchy

  • class \Drupal\Component\EventDispatcher\Event extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of MigrateIdMapMessageEvent

4 files declare their use of MigrateIdMapMessageEvent
MigrateEntityContentValidationTest.php in core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php
MigrateMessageTest.php in core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php
MigrateUpgradeImportBatch.php in core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php
Sql.php in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php

File

core/modules/migrate/src/Event/MigrateIdMapMessageEvent.php, line 11

Namespace

Drupal\migrate\Event
View source
class MigrateIdMapMessageEvent extends Event {
    
    /**
     * Migration entity.
     *
     * @var \Drupal\migrate\Plugin\MigrationInterface
     */
    protected $migration;
    
    /**
     * Array of values uniquely identifying the source row.
     *
     * @var array
     */
    protected $sourceIdValues;
    
    /**
     * Message to be logged.
     *
     * @var string
     */
    protected $message;
    
    /**
     * Message severity.
     *
     * @var int
     */
    protected $level;
    
    /**
     * Constructs a post-save event object.
     *
     * @param \Drupal\migrate\Plugin\MigrationInterface $migration
     *   Migration entity.
     * @param array $source_id_values
     *   Values represent the source ID.
     * @param string $message
     *   The message
     * @param int $level
     *   Severity level (one of the MigrationInterface::MESSAGE_* constants).
     */
    public function __construct(MigrationInterface $migration, array $source_id_values, $message, $level) {
        $this->migration = $migration;
        $this->sourceIdValues = $source_id_values;
        $this->message = $message;
        $this->level = $level;
    }
    
    /**
     * Gets the migration entity.
     *
     * @return \Drupal\migrate\Plugin\MigrationInterface
     *   The migration entity involved.
     */
    public function getMigration() {
        return $this->migration;
    }
    
    /**
     * Gets the source ID values.
     *
     * @return array
     *   The source ID as an array.
     */
    public function getSourceIdValues() {
        return $this->sourceIdValues;
    }
    
    /**
     * Gets the message to be logged.
     *
     * @return string
     *   The message text.
     */
    public function getMessage() {
        return $this->message;
    }
    
    /**
     * Gets the severity level of the message.
     *
     * Message levels are declared in MigrationInterface and start with MESSAGE_.
     *
     * @see \Drupal\migrate\Plugin\MigrationInterface
     *
     * @return int
     *   The message level.
     */
    public function getLevel() {
        return $this->level;
    }

}

Members

Title Sort descending Modifiers Object type Summary
MigrateIdMapMessageEvent::$level protected property Message severity.
MigrateIdMapMessageEvent::$message protected property Message to be logged.
MigrateIdMapMessageEvent::$migration protected property Migration entity.
MigrateIdMapMessageEvent::$sourceIdValues protected property Array of values uniquely identifying the source row.
MigrateIdMapMessageEvent::getLevel public function Gets the severity level of the message.
MigrateIdMapMessageEvent::getMessage public function Gets the message to be logged.
MigrateIdMapMessageEvent::getMigration public function Gets the migration entity.
MigrateIdMapMessageEvent::getSourceIdValues public function Gets the source ID values.
MigrateIdMapMessageEvent::__construct public function Constructs a post-save event object.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.