Use DI to inject MP2Migrator to MP2Migrator API endpoint and Changelog
[MAILPOET-2203]
This commit is contained in:
committed by
Rostislav Wolný
parent
92495b20a5
commit
47861cdf19
@ -11,10 +11,12 @@ class MP2Migrator extends APIEndpoint {
|
||||
public $permissions = [
|
||||
'global' => AccessControl::PERMISSION_MANAGE_SETTINGS,
|
||||
];
|
||||
|
||||
/** @var \MailPoet\Config\MP2Migrator */
|
||||
private $MP2Migrator;
|
||||
|
||||
public function __construct() {
|
||||
$this->MP2Migrator = new \MailPoet\Config\MP2Migrator();
|
||||
public function __construct(\MailPoet\Config\MP2Migrator $MP2Migrator) {
|
||||
$this->MP2Migrator = $MP2Migrator;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -25,7 +27,7 @@ class MP2Migrator extends APIEndpoint {
|
||||
*/
|
||||
public function import($data) {
|
||||
try {
|
||||
$process = $this->MP2Migrator->import($data);
|
||||
$process = $this->MP2Migrator->import();
|
||||
return $this->successResponse($process);
|
||||
} catch (\Exception $e) {
|
||||
return $this->errorResponse([
|
||||
|
Reference in New Issue
Block a user