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 Symfony\Component\EventDispatcher\Event;
|
Chris@0
|
7
|
Chris@0
|
8 /**
|
Chris@0
|
9 * Wraps an idmap message event for event listeners.
|
Chris@0
|
10 */
|
Chris@0
|
11 class MigrateIdMapMessageEvent extends Event {
|
Chris@0
|
12
|
Chris@0
|
13 /**
|
Chris@0
|
14 * Migration entity.
|
Chris@0
|
15 *
|
Chris@0
|
16 * @var \Drupal\migrate\Plugin\MigrationInterface
|
Chris@0
|
17 */
|
Chris@0
|
18 protected $migration;
|
Chris@0
|
19
|
Chris@0
|
20 /**
|
Chris@0
|
21 * Array of values uniquely identifying the source row.
|
Chris@0
|
22 *
|
Chris@0
|
23 * @var array
|
Chris@0
|
24 */
|
Chris@0
|
25 protected $sourceIdValues;
|
Chris@0
|
26
|
Chris@0
|
27 /**
|
Chris@0
|
28 * Message to be logged.
|
Chris@0
|
29 *
|
Chris@0
|
30 * @var string
|
Chris@0
|
31 */
|
Chris@0
|
32 protected $message;
|
Chris@0
|
33
|
Chris@0
|
34 /**
|
Chris@0
|
35 * Message severity.
|
Chris@0
|
36 *
|
Chris@0
|
37 * @var int
|
Chris@0
|
38 */
|
Chris@0
|
39 protected $level;
|
Chris@0
|
40
|
Chris@0
|
41 /**
|
Chris@0
|
42 * Constructs a post-save event object.
|
Chris@0
|
43 *
|
Chris@0
|
44 * @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
Chris@0
|
45 * Migration entity.
|
Chris@0
|
46 * @param array $source_id_values
|
Chris@0
|
47 * Values represent the source ID.
|
Chris@0
|
48 * @param string $message
|
Chris@0
|
49 * The message
|
Chris@0
|
50 * @param int $level
|
Chris@0
|
51 * Severity level (one of the MigrationInterface::MESSAGE_* constants).
|
Chris@0
|
52 */
|
Chris@0
|
53 public function __construct(MigrationInterface $migration, array $source_id_values, $message, $level) {
|
Chris@0
|
54 $this->migration = $migration;
|
Chris@0
|
55 $this->sourceIdValues = $source_id_values;
|
Chris@0
|
56 $this->message = $message;
|
Chris@0
|
57 $this->level = $level;
|
Chris@0
|
58 }
|
Chris@0
|
59
|
Chris@0
|
60 /**
|
Chris@0
|
61 * Gets the migration entity.
|
Chris@0
|
62 *
|
Chris@0
|
63 * @return \Drupal\migrate\Plugin\MigrationInterface
|
Chris@0
|
64 * The migration entity involved.
|
Chris@0
|
65 */
|
Chris@0
|
66 public function getMigration() {
|
Chris@0
|
67 return $this->migration;
|
Chris@0
|
68 }
|
Chris@0
|
69
|
Chris@0
|
70 /**
|
Chris@0
|
71 * Gets the source ID values.
|
Chris@0
|
72 *
|
Chris@0
|
73 * @return array
|
Chris@0
|
74 * The source ID as an array.
|
Chris@0
|
75 */
|
Chris@0
|
76 public function getSourceIdValues() {
|
Chris@0
|
77 return $this->sourceIdValues;
|
Chris@0
|
78 }
|
Chris@0
|
79
|
Chris@0
|
80 /**
|
Chris@0
|
81 * Gets the message to be logged.
|
Chris@0
|
82 *
|
Chris@0
|
83 * @return string
|
Chris@0
|
84 * The message text.
|
Chris@0
|
85 */
|
Chris@0
|
86 public function getMessage() {
|
Chris@0
|
87 return $this->message;
|
Chris@0
|
88 }
|
Chris@0
|
89
|
Chris@0
|
90 /**
|
Chris@0
|
91 * Gets the severity level of the message (one of the
|
Chris@0
|
92 * MigrationInterface::MESSAGE_* constants).
|
Chris@0
|
93 *
|
Chris@0
|
94 * @return int
|
Chris@0
|
95 * The message level.
|
Chris@0
|
96 */
|
Chris@0
|
97 public function getLevel() {
|
Chris@0
|
98 return $this->level;
|
Chris@0
|
99 }
|
Chris@0
|
100
|
Chris@0
|
101 }
|