Skip to content

Commit

Permalink
Merge pull request #339 from perftools/id-override
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc authored Sep 30, 2020
2 parents b077dc0 + 94d0e02 commit 8c90bbe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 1 addition & 14 deletions src/Xhgui/Saver/MongoSaver.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,11 @@ public function save(array $data)
];

$a = [
'_id' => $data['_id'] ?? self::getLastProfilingId(),
'_id' => $data['_id'] ?? new MongoId(),
'meta' => $meta,
'profile' => $data['profile'],
];

return $this->_collection->insert($a, ['w' => 0]);
}

/**
* Return profiling ID
* @return MongoId lastProfilingId
*/
public static function getLastProfilingId()
{
if (!self::$lastProfilingId) {
self::$lastProfilingId = new MongoId();
}

return self::$lastProfilingId;
}
}
2 changes: 1 addition & 1 deletion src/Xhgui/Saver/PdoSaver.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function save(array $data)
$usec = $ts['usec'];

$this->stmt->execute([
'id' => Util::generateId(),
'id' => $data['_id'] ?? Util::generateId(),
'profile' => json_encode($data['profile']),
'url' => $data['meta']['url'],
'SERVER' => json_encode($data['meta']['SERVER']),
Expand Down

0 comments on commit 8c90bbe

Please sign in to comment.