Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\migrate_plus\Event;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\migrate\Plugin\MigrationInterface;
|
Chris@0
|
6 use Drupal\migrate\Plugin\MigrateSourceInterface;
|
Chris@0
|
7 use Drupal\migrate\Row;
|
Chris@0
|
8 use Symfony\Component\EventDispatcher\Event;
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Wraps a prepare-row event for event listeners.
|
Chris@0
|
12 */
|
Chris@0
|
13 class MigratePrepareRowEvent extends Event {
|
Chris@0
|
14
|
Chris@0
|
15 /**
|
Chris@0
|
16 * Row object.
|
Chris@0
|
17 *
|
Chris@0
|
18 * @var \Drupal\migrate\Row
|
Chris@0
|
19 */
|
Chris@0
|
20 protected $row;
|
Chris@0
|
21
|
Chris@0
|
22 /**
|
Chris@0
|
23 * Migration source plugin.
|
Chris@0
|
24 *
|
Chris@0
|
25 * @var \Drupal\migrate\Plugin\MigrateSourceInterface
|
Chris@0
|
26 */
|
Chris@0
|
27 protected $source;
|
Chris@0
|
28
|
Chris@0
|
29 /**
|
Chris@0
|
30 * Migration plugin.
|
Chris@0
|
31 *
|
Chris@0
|
32 * @var \Drupal\migrate\Plugin\MigrationInterface
|
Chris@0
|
33 */
|
Chris@0
|
34 protected $migration;
|
Chris@0
|
35
|
Chris@0
|
36 /**
|
Chris@0
|
37 * Constructs a prepare-row event object.
|
Chris@0
|
38 *
|
Chris@0
|
39 * @param \Drupal\migrate\Row $row
|
Chris@0
|
40 * Row of source data to be analyzed/manipulated.
|
Chris@0
|
41 *
|
Chris@0
|
42 * @param \Drupal\migrate\Plugin\MigrateSourceInterface $source
|
Chris@0
|
43 * Source plugin that is the source of the event.
|
Chris@0
|
44 *
|
Chris@0
|
45 * @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
Chris@0
|
46 * Migration entity.
|
Chris@0
|
47 */
|
Chris@0
|
48 public function __construct(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
|
Chris@0
|
49 $this->row = $row;
|
Chris@0
|
50 $this->source = $source;
|
Chris@0
|
51 $this->migration = $migration;
|
Chris@0
|
52 }
|
Chris@0
|
53
|
Chris@0
|
54 /**
|
Chris@0
|
55 * Gets the row object.
|
Chris@0
|
56 *
|
Chris@0
|
57 * @return \Drupal\migrate\Row
|
Chris@0
|
58 * The row object about to be imported.
|
Chris@0
|
59 */
|
Chris@0
|
60 public function getRow() {
|
Chris@0
|
61 return $this->row;
|
Chris@0
|
62 }
|
Chris@0
|
63
|
Chris@0
|
64 /**
|
Chris@0
|
65 * Gets the source plugin.
|
Chris@0
|
66 *
|
Chris@0
|
67 * @return \Drupal\migrate\Plugin\MigrateSourceInterface $source
|
Chris@0
|
68 * The source plugin firing the event.
|
Chris@0
|
69 */
|
Chris@0
|
70 public function getSource() {
|
Chris@0
|
71 return $this->source;
|
Chris@0
|
72 }
|
Chris@0
|
73
|
Chris@0
|
74 /**
|
Chris@0
|
75 * Gets the migration plugin.
|
Chris@0
|
76 *
|
Chris@0
|
77 * @return \Drupal\migrate\Plugin\MigrationInterface
|
Chris@0
|
78 * The migration entity being imported.
|
Chris@0
|
79 */
|
Chris@0
|
80 public function getMigration() {
|
Chris@0
|
81 return $this->migration;
|
Chris@0
|
82 }
|
Chris@0
|
83
|
Chris@0
|
84 }
|