Nette\Bridges\DatabaseTracy\ConnectionPanel::renderException PHP Метод

renderException() публичный статический Метод

public static renderException ( $e )
    public static function renderException($e)
    {
        if (!$e instanceof \PDOException) {
            return;
        }
        if (isset($e->queryString)) {
            $sql = $e->queryString;
        } elseif ($item = Tracy\Helpers::findTrace($e->getTrace(), 'PDO::prepare')) {
            $sql = $item['args'][0];
        }
        return isset($sql) ? ['tab' => 'SQL', 'panel' => Helpers::dumpSql($sql)] : NULL;
    }

Usage Example

Пример #1
0
 /**
  * @param \PDOException
  * @return array
  */
 public function renderException($e)
 {
     if ($e instanceof \PDOException && count($this->queries)) {
         $s = '<table><tr><th>Time&nbsp;ms</th><th>SQL</th><th>Params</th></tr>';
         $s .= $this->processQuery(end($this->queries));
         $s .= '</table>';
         return array('tab' => 'SQL', 'panel' => $this->renderStyles() . '<div class="nette-inner nette-Doctrine2Panel">' . $s . '</div>');
     } else {
         ConnectionPanel::renderException($e);
     }
 }