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 * @param \Drupal\migrate\Plugin\MigrateSourceInterface $source
|
Chris@0
|
42 * Source plugin that is the source of the event.
|
Chris@0
|
43 * @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
Chris@0
|
44 * Migration entity.
|
Chris@0
|
45 */
|
Chris@0
|
46 public function __construct(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
|
Chris@0
|
47 $this->row = $row;
|
Chris@0
|
48 $this->source = $source;
|
Chris@0
|
49 $this->migration = $migration;
|
Chris@0
|
50 }
|
Chris@0
|
51
|
Chris@0
|
52 /**
|
Chris@0
|
53 * Gets the row object.
|
Chris@0
|
54 *
|
Chris@0
|
55 * @return \Drupal\migrate\Row
|
Chris@0
|
56 * The row object about to be imported.
|
Chris@0
|
57 */
|
Chris@0
|
58 public function getRow() {
|
Chris@0
|
59 return $this->row;
|
Chris@0
|
60 }
|
Chris@0
|
61
|
Chris@0
|
62 /**
|
Chris@0
|
63 * Gets the source plugin.
|
Chris@0
|
64 *
|
Chris@4
|
65 * @return \Drupal\migrate\Plugin\MigrateSourceInterface
|
Chris@0
|
66 * The source plugin firing the event.
|
Chris@0
|
67 */
|
Chris@0
|
68 public function getSource() {
|
Chris@0
|
69 return $this->source;
|
Chris@0
|
70 }
|
Chris@0
|
71
|
Chris@0
|
72 /**
|
Chris@0
|
73 * Gets the migration plugin.
|
Chris@0
|
74 *
|
Chris@0
|
75 * @return \Drupal\migrate\Plugin\MigrationInterface
|
Chris@0
|
76 * The migration entity being imported.
|
Chris@0
|
77 */
|
Chris@0
|
78 public function getMigration() {
|
Chris@0
|
79 return $this->migration;
|
Chris@0
|
80 }
|
Chris@0
|
81
|
Chris@0
|
82 }
|