Version 1
[yaffs-website] / web / core / modules / migrate / src / Event / MigrateMapDeleteEvent.php
1 <?php
2
3 namespace Drupal\migrate\Event;
4
5 use Drupal\migrate\Plugin\MigrateIdMapInterface;
6 use Symfony\Component\EventDispatcher\Event;
7
8 /**
9  * Wraps a migrate map delete event for event listeners.
10  */
11 class MigrateMapDeleteEvent extends Event {
12
13   /**
14    * Map plugin.
15    *
16    * @var \Drupal\migrate\Plugin\MigrateIdMapInterface
17    */
18   protected $map;
19
20   /**
21    * Array of source ID fields.
22    *
23    * @var array
24    */
25   protected $sourceId;
26
27   /**
28    * Constructs a migration map delete event object.
29    *
30    * @param \Drupal\migrate\Plugin\MigrateIdMapInterface $map
31    *   Map plugin.
32    * @param array $source_id
33    *   Array of source ID fields representing the object being deleted from the map.
34    */
35   public function __construct(MigrateIdMapInterface $map, array $source_id) {
36     $this->map = $map;
37     $this->sourceId = $source_id;
38   }
39
40   /**
41    * Gets the map plugin.
42    *
43    * @return \Drupal\migrate\Plugin\MigrateIdMapInterface
44    *   The map plugin that caused the event to fire.
45    */
46   public function getMap() {
47     return $this->map;
48   }
49
50   /**
51    * Gets the source ID of the item being removed from the map.
52    *
53    * @return array
54    *   Array of source ID fields.
55    */
56   public function getSourceId() {
57     return $this->sourceId;
58   }
59
60 }