MigratePrepareRowEvent.php 1.76 KB
Newer Older
Mike Ryan's avatar
.  
Mike Ryan committed
1
2
3
4
5
<?php

namespace Drupal\migrate_plus\Event;

use Drupal\migrate\Plugin\MigrateSourceInterface;
6
use Drupal\migrate\Plugin\MigrationInterface;
Mike Ryan's avatar
.  
Mike Ryan committed
7
use Drupal\migrate\Row;
8
use Symfony\Contracts\EventDispatcher\Event;
Mike Ryan's avatar
.  
Mike Ryan committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22

/**
 * Wraps a prepare-row event for event listeners.
 */
class MigratePrepareRowEvent extends Event {

  /**
   * Row object.
   *
   * @var \Drupal\migrate\Row
   */
  protected $row;

  /**
23
   * Migration source plugin.
Mike Ryan's avatar
.  
Mike Ryan committed
24
25
26
27
28
   *
   * @var \Drupal\migrate\Plugin\MigrateSourceInterface
   */
  protected $source;

29
  /**
30
   * Migration plugin.
31
   *
32
   * @var \Drupal\migrate\Plugin\MigrationInterface
33
34
35
   */
  protected $migration;

Mike Ryan's avatar
.  
Mike Ryan committed
36
37
38
39
40
41
42
  /**
   * Constructs a prepare-row event object.
   *
   * @param \Drupal\migrate\Row $row
   *   Row of source data to be analyzed/manipulated.
   * @param \Drupal\migrate\Plugin\MigrateSourceInterface $source
   *   Source plugin that is the source of the event.
43
   * @param \Drupal\migrate\Plugin\MigrationInterface $migration
44
   *   Migration entity.
Mike Ryan's avatar
.  
Mike Ryan committed
45
   */
46
  public function __construct(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
Mike Ryan's avatar
.  
Mike Ryan committed
47
48
    $this->row = $row;
    $this->source = $source;
49
    $this->migration = $migration;
Mike Ryan's avatar
.  
Mike Ryan committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  }

  /**
   * Gets the row object.
   *
   * @return \Drupal\migrate\Row
   *   The row object about to be imported.
   */
  public function getRow() {
    return $this->row;
  }

  /**
   * Gets the source plugin.
   *
65
   * @return \Drupal\migrate\Plugin\MigrateSourceInterface
Mike Ryan's avatar
.  
Mike Ryan committed
66
67
68
69
70
71
   *   The source plugin firing the event.
   */
  public function getSource() {
    return $this->source;
  }

72
  /**
73
   * Gets the migration plugin.
74
   *
75
   * @return \Drupal\migrate\Plugin\MigrationInterface
76
77
78
79
80
81
   *   The migration entity being imported.
   */
  public function getMigration() {
    return $this->migration;
  }

Mike Ryan's avatar
.  
Mike Ryan committed
82
}