Rename imported_data_mapping table to mapping_to_external_entities

This commit is contained in:
fred
2017-05-18 06:44:07 +02:00
parent c78933f7c4
commit 8517896660
5 changed files with 11 additions and 11 deletions

View File

@@ -77,7 +77,7 @@ class Database {
$statistics_opens = Env::$db_prefix . 'statistics_opens';
$statistics_unsubscribes = Env::$db_prefix . 'statistics_unsubscribes';
$statistics_forms = Env::$db_prefix . 'statistics_forms';
$imported_data_mapping = Env::$db_prefix . 'imported_data_mapping';
$mapping_to_external_entities = Env::$db_prefix . 'mapping_to_external_entities';
define('MP_SETTINGS_TABLE', $settings);
define('MP_SEGMENTS_TABLE', $segments);
@@ -99,7 +99,7 @@ class Database {
define('MP_STATISTICS_OPENS_TABLE', $statistics_opens);
define('MP_STATISTICS_UNSUBSCRIBES_TABLE', $statistics_unsubscribes);
define('MP_STATISTICS_FORMS_TABLE', $statistics_forms);
define('MP_IMPORTED_DATA_MAPPING_TABLE', $imported_data_mapping);
define('MP_MAPPING_TO_EXTERNAL_ENTITIES_TABLE', $mapping_to_external_entities);
}
}
}

View File

@@ -9,7 +9,7 @@ use MailPoet\Models\Subscriber;
use MailPoet\Models\CustomField;
use MailPoet\Models\SubscriberSegment;
use MailPoet\Models\SubscriberCustomField;
use MailPoet\Models\ImportedDataMapping;
use MailPoet\Models\MappingToExternalEntities;
use MailPoet\Config\Activator;
if(!defined('ABSPATH')) exit;
@@ -520,7 +520,7 @@ class MP2Migrator {
));
Setting::setValue('last_imported_user_id', $user_data['user_id']);
if(!empty($subscriber)) {
$mapping = new ImportedDataMapping();
$mapping = new MappingToExternalEntities();
$mapping->create(array(
'old_id' => $user_data['user_id'],
'type' => 'subscribers',
@@ -677,7 +677,7 @@ class MP2Migrator {
*/
public function getImportedMapping($model) {
$mappings = array();
$mapping_relations = ImportedDataMapping::where('type', $model)->findArray();
$mapping_relations = MappingToExternalEntities::where('type', $model)->findArray();
foreach($mapping_relations as $relation) {
$mappings[$relation['old_id']] = $relation['new_id'];
}

View File

@@ -34,7 +34,7 @@ class Migrator {
'statistics_opens',
'statistics_unsubscribes',
'statistics_forms',
'imported_data_mapping'
'mapping_to_external_entities'
);
}
@@ -364,7 +364,7 @@ class Migrator {
return $this->sqlify(__FUNCTION__, $attributes);
}
function importedDataMapping() {
function mappingToExternalEntities() {
$attributes = array(
'old_id mediumint(9) NOT NULL,',
'type varchar(50) NOT NULL,',

View File

@@ -3,8 +3,8 @@ namespace MailPoet\Models;
if(!defined('ABSPATH')) exit;
class ImportedDataMapping extends Model {
public static $_table = MP_IMPORTED_DATA_MAPPING_TABLE;
class MappingToExternalEntities extends Model {
public static $_table = MP_MAPPING_TO_EXTERNAL_ENTITIES_TABLE;
static function create($data = array()) {
$relation = parent::create();

View File

@@ -2,7 +2,7 @@
use MailPoet\Config\MP2Migrator;
use MailPoet\Models\Setting;
use MailPoet\Models\CustomField;
use MailPoet\Models\ImportedDataMapping;
use MailPoet\Models\MappingToExternalEntities;
use MailPoet\Models\Segment;
use MailPoet\Models\Subscriber;
use MailPoet\Models\SubscriberCustomField;
@@ -347,7 +347,7 @@ class MP2MigratorTest extends MailPoetTest {
*/
public function testGetImportedMapping() {
$this->initImport();
$mapping = new ImportedDataMapping();
$mapping = new MappingToExternalEntities();
$old_id = 999;
$new_id = 500;
$type = 'testMapping';