fixed map im/export bug

This commit is contained in:
Exodus4D
2015-11-11 20:34:05 +01:00
parent 3e659f6e51
commit 0b6bb4deb7
2 changed files with 14 additions and 11 deletions

View File

@@ -175,8 +175,8 @@ class Map extends \Controller\AccessController {
isset($mapData['data']['systems']) &&
isset($mapData['data']['connections'])
){
if(isset($mapData['id'])){
unset($mapData['id']);
if(isset($mapData['config']['id'])){
unset($mapData['config']['id']);
}
$map->setData($mapData['config']);
@@ -189,18 +189,21 @@ class Map extends \Controller\AccessController {
foreach($mapData['data']['systems'] as $systemData){
if(isset($systemData['id'])){
$oldId = (int)$systemData['id'];
unset($systemData['id']);
}
$system->setData($systemData);
$system->mapId = $map;
$system->createdCharacterId = $activeCharacter->characterId;
$system->updatedCharacterId = $activeCharacter->characterId;
$system->save();
$tempSystemIdMapping[$systemData['id']] = $system->id;
$system->reset();
$system->setData($systemData);
$system->mapId = $map;
$system->createdCharacterId = $activeCharacter->characterId;
$system->updatedCharacterId = $activeCharacter->characterId;
$system->save();
$tempSystemIdMapping[$oldId] = $system->id;
$system->reset();
}
}
foreach($mapData['data']['connections'] as $connectionData){
// check if source and target IDs match with new system ID
if(