*/ class PanelController extends Controller { /** * This method renders the global Propel configuration. */ public function configurationAction() { return $this->render( '@Propel/Panel/configuration.html.twig', array( 'propel_version' => Propel::VERSION, 'configuration' => $this->getParameter('propel.configuration'), 'logging' => $this->getParameter('propel.logging'), ) ); } /** * Renders the profiler panel for the given token. * * @param string $token The profiler token * @param string $connection The connection name * @param integer $query * * @return Response A Response instance */ public function explainAction($token, $connection, $query) { $profiler = $this->get('profiler'); $profiler->disable(); $profile = $profiler->loadProfile($token); $queries = $profile->getCollector('propel')->getQueries(); if (!isset($queries[$query])) { return new Response('This query does not exist.'); } // Open the connection $con = Propel::getConnection($connection); try { $dataFetcher = $con->query('EXPLAIN ' . $queries[$query]['sql']); $results = array(); while (($results[] = $dataFetcher->fetch(\PDO::FETCH_ASSOC))); } catch (\Exception $e) { return new Response('
This query cannot be explained.
'); } return $this->render( '@Propel/Panel/explain.html.twig', array( 'data' => $results, 'query' => $query, ) ); } }