Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/db panel trace hash error fix #295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.2.8

- Fixes #294 - DB Panel error (trashHash undefined)

## 1.2.7
- Move differences in audit trail view in DetailWidget
- New module option `$enablePrettyDiffForTrails` to prettyfied json output
Expand Down
31 changes: 9 additions & 22 deletions src/panels/DbPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ public function getDetail()
}

$models = $this->getModels();
$dataProvider = $searchModel->search($models);
$dataProvider->getSort()->defaultOrder = $this->defaultOrder;
$queryDataProvider = $searchModel->search($models);
$queryDataProvider->getSort()->defaultOrder = $this->defaultOrder;
$sumDuplicates = $this->sumDuplicateQueries($models);
$callerDataProvider = $this->generateQueryCallersDataProvider($models);

return Yii::$app->view->render('@yii/debug/views/default/panels/db/detail', [
'panel' => $this,
'dataProvider' => $dataProvider,
'queryDataProvider' => $queryDataProvider,
'callerDataProvider' => $callerDataProvider,
'searchModel' => $searchModel,
'hasExplain' => method_exists($this, 'hasExplain') ? $this->hasExplain() : null,
'sumDuplicates' => method_exists($this, 'sumDuplicateQueries') ? $this->sumDuplicateQueries($models) : null,
'hasExplain' => $this->hasExplain(),
'sumDuplicates' => $sumDuplicates,
]);
}

Expand All @@ -71,20 +74,4 @@ public function registerAssets($view)
{
GridViewAsset::register($view);
}

/**
* Calculates given request profile timings.
*
* @return array timings [token, category, timestamp, traces, nesting level, elapsed time]
*/
public function calculateTimings()
{
if ($this->_timings === null) {
$this->_timings = [];
if (isset($this->data['messages'])) {
$this->_timings = Yii::getLogger()->calculateTimings($this->data['messages']);
}
}
return $this->_timings;
}
}
}