php - symfony2 include class pretty sql formatter and output sql to template -
i'm looking utilize pretty sql formatter included library symfony2. output sql's on template page.
formatter included here /vendor/jdorn/sql-formatter/lib/sqlformatter.
i pass twig template
pagecontroller.php
$querybasesql = "select * exampletable 'this' = 1 "; homecoming $this->render('sjquerybundle:page:index.html.twig', array( 'querybasesql' => $querybasesql ));
i hoping able phone call within twig
(index.html.twig)
{{ sqlformatter::format(querybasesql) }}
$querybasesql = "select * exampletable 'this' = 1 "; homecoming $this->render('sjquerybundle:page:index.html.twig', array( 'querybasesql' => \sqlformatter::format($querybasesql); ));
twig:
{{ querybasesql|raw }}
php symfony2 twig
No comments:
Post a Comment