summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/migrate/src/Event/MigrateMapSaveEvent.php
blob: d42823bcb07916991918cacb05caf3d8191fc57e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php

namespace Drupal\migrate\Event;

use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\Component\EventDispatcher\Event;

/**
 * Wraps a migrate map save event for event listeners.
 */
class MigrateMapSaveEvent extends Event {

  /**
   * Map plugin.
   *
   * @var \Drupal\migrate\Plugin\MigrateIdMapInterface
   */
  protected $map;

  /**
   * Array of fields being saved to the map, keyed by field name.
   *
   * @var array
   */
  protected $fields;

  /**
   * Constructs a migration map event object.
   *
   * @param \Drupal\migrate\Plugin\MigrateIdMapInterface $map
   *   Map plugin.
   * @param array $fields
   *   Array of fields being saved to the map.
   */
  public function __construct(MigrateIdMapInterface $map, array $fields) {
    $this->map = $map;
    $this->fields = $fields;
  }

  /**
   * Gets the map plugin.
   *
   * @return \Drupal\migrate\Plugin\MigrateIdMapInterface
   *   The map plugin that caused the event to fire.
   */
  public function getMap() {
    return $this->map;
  }

  /**
   * Gets the fields about to be saved to the map.
   *
   * @return array
   *   Array of map fields, keyed by field name.
   */
  public function getFields() {
    return $this->fields;
  }

}