Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MigrationFactory.php
Go to the documentation of this file.
1 <?php
8 
13 {
19  protected $_objectManager = null;
20 
26  protected $_instanceName = null;
27 
34  public function __construct(
36  $instanceName = \Magento\Framework\Module\Setup\Migration::class
37  ) {
38  $this->_objectManager = $objectManager;
39  $this->_instanceName = $instanceName;
40  }
41 
49  public function create(array $data = [])
50  {
51  $migrationInstance = $this->_objectManager->create($this->_instanceName, $data);
52 
53  if (!$migrationInstance instanceof \Magento\Framework\Module\Setup\Migration) {
54  throw new \InvalidArgumentException(
55  $this->_instanceName . ' doesn\'n extend \Magento\Framework\Module\Setup\Migration'
56  );
57  }
58  return $migrationInstance;
59  }
60 }
$objectManager
Definition: bootstrap.php:17
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, $instanceName=\Magento\Framework\Module\Setup\Migration::class)