Permalink
Browse files

update for null queries

  • Loading branch information...
1 parent 50cd09e commit 94d44ca48b04b536287cbf4c10f8ca6570186590 @bazo bazo committed Jul 29, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 Bazo/Extensions/Neo4j/Diagnostics/Panel.php
@@ -34,8 +34,9 @@ class Panel extends Nette\Object implements Nette\Diagnostics\IBarPanel
*/
private $queries = array();
- private function getQueryType(Query $query)
+ private function getQueryType(Query $query = null)
{
+ if($query === null) return null;
$types = array(
'Everyman\Neo4j\Cypher\Query' => 'cypher',
'Everyman\Neo4j\Gremlin\Query' => 'gremlin'
@@ -44,15 +45,15 @@ private function getQueryType(Query $query)
return $types[$class];
}
- public function addQuery(Query $query, $parameters, $time)
+ public function addQuery(Query $query = null, $parameters = array(), $time = null)
{
$type = $this->getQueryType($query);
$queryEntry = (object)array(
'type' => $type,
- 'query'=> $query->getQuery(),
+ 'query'=> ($query !== null) ? $query->getQuery() : '',
'parameters' => $parameters,
'time' => $time,
- 'results' => $query->getResultSet()->count()
+ 'results' => ($query !== null) ? $query->getResultSet()->count() : 'n/a'
);
$this->totalTime += $time;

0 comments on commit 94d44ca

Please sign in to comment.