File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 },
1818 "require" : {
1919 "php" : " >=7.3.0" ,
20- "jdorn /sql-formatter" : " ^1.2.17 " ,
21- "symfony/var-dumper" : " ^5.1.3 "
20+ "doctrine /sql-formatter" : " ^1.1 " ,
21+ "symfony/var-dumper" : " ^5.2 "
2222 },
2323 "require-dev" : {
2424 "mako/framework" : " ^7.0.0-dev"
Original file line number Diff line number Diff line change 77
88namespace mako \toolbar \panels ;
99
10+ use Doctrine \SqlFormatter \HtmlHighlighter ;
11+ use Doctrine \SqlFormatter \SqlFormatter ;
1012use mako \database \ConnectionManager ;
1113use mako \view \ViewFactory ;
12- use SqlFormatter ;
1314
1415use function array_column ;
1516use function array_sum ;
@@ -27,7 +28,7 @@ class DatabasePanel extends Panel implements PanelInterface
2728 /**
2829 * Conenction manager instance.
2930 *
30- * @var array
31+ * @var \mako\database\ConnectionManager
3132 */
3233 protected $ database ;
3334
@@ -87,17 +88,22 @@ public function getTabLabel(): string
8788 */
8889 protected function getFormattedLog (array $ logs ): array
8990 {
90- // Configure the SQL formatter
91+ // Configure the SQL highlighter
9192
92- SqlFormatter::$ pre_attributes = 'style="color: black; background-color: transparent;" ' ;
93+ $ highlighter = new HtmlHighlighter
94+ ([
95+ HtmlHighlighter::HIGHLIGHT_PRE => 'style="color: inherit; background-color: transparent;" ' ,
96+ ]);
9397
9498 // Add syntax highlighting to SQL queries
9599
100+ $ formatter = new SqlFormatter ($ highlighter );
101+
96102 foreach ($ logs as &$ log )
97103 {
98104 foreach ($ log as $ key => $ query )
99105 {
100- $ log [$ key ]['query ' ] = SqlFormatter:: format ($ query ['query ' ]);
106+ $ log [$ key ]['query ' ] = $ formatter -> format ($ query ['query ' ]);
101107 }
102108 }
103109
You can’t perform that action at this time.
0 commit comments