Skip to content

Commit

Permalink
Export now includes metadata
Browse files Browse the repository at this point in the history
Refs #480 #734
  • Loading branch information
benwerd committed Feb 25, 2015
1 parent ab8e974 commit 738a321
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Idno/Data/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,20 @@ function exportRecords($collection = 'entities')
$line .= '(' . implode(',',$fields) . ')';
$line .= ' values ';
$line .= '(' . implode(',', $object) . ');';
$output .= $line . "\n";

$output .= $line . "\n\n";
$metadata_statement = $client->prepare("select * from metadata where `entity` = '{$fields['uuid']}'");
if ($metadata_response = $metadata_statement->execute()) {
while ($metadata_object = $statement->fetch(\PDO::FETCH_ASSOC)) {
$fields = array_keys($object);
$fields = array_map(function($v) { return '`' . $v . '`'; }, $fields);
$object = array_map(function($v) { return \Idno\Core\site()->db()->getClient()->quote($v); }, $object);
$line = 'insert into metadata ';
$line .= '(' . implode(',',$fields) . ')';
$line .= ' values ';
$line .= '(' . implode(',', $object) . ');';
$output .= $line . "\n";
}
}
}
}
return $output;
Expand Down

0 comments on commit 738a321

Please sign in to comment.