Permalink
Browse files

Added profiler views

  • Loading branch information...
willdurand committed Apr 6, 2011
1 parent a6e6d5f commit 1ddd9272507ed0d2b81a81763540dce4f484f690
@@ -0,0 +1,28 @@
+<?php
+
+namespace Propel\PropelBundle\Controller;
+
+use Symfony\Component\DependencyInjection\ContainerAware;
+
+use Propel\PropelBundle\DataCollector\PropelDataCollector;
+
+class PanelController extends ContainerAware
+{
+ public function configurationAction(PropelDataCollector $collector)
+ {
+ $templating = $this->container->get('templating');
+
+ return $templating->renderResponse(
+ 'PropelBundle:Panel:configuration.html.twig',
+ array(
+ 'configuration' => $this->container->get('propel.configuration')->getParameters(),
+ 'default_connection' => $this->container->getParameter('propel.dbal.default_connection'),
+ 'logging' => $this->container->getParameter('propel.logging'),
+ 'charset' => $this->container->getParameter('propel.charset'),
+ 'path' => $this->container->getParameter('propel.path'),
+ 'phing_path' => $this->container->getParameter('propel.phing_path'),
+ )
+ );
+ }
+
+}
@@ -0,0 +1,60 @@
+<?php
+
+/*
+ * This file is part of the FOSPropel package.
+ *
+ * (c) William DURAND <william.durand1@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Propel\PropelBundle\DataCollector;
+
+use Symfony\Component\HttpKernel\DataCollector\DataCollector;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+
+/**
+ * The PropelDataCollector collector class collects information.
+ *
+ * @author William DURAND <william.durand1@gmail.com>
+ */
+class PropelDataCollector extends DataCollector
+{
+ /**
+ * Propel logger
+ *
+ * @var Propel\PropelBundle\Logger\PropelLogger
+ */
+ private $logger;
+
+ private $connectionName;
+
+ public function __construct(\Propel\PropelBundle\Logger\PropelLogger $logger, $connectionName)
+ {
+ $this->logger = $logger;
+ $this->connectionName = $connectionName;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ */
+ public function collect(Request $request, Response $response, \Exception $exception = null)
+ {
+ $this->data = array(
+ 'connectionName' => $this->connectionName,
+ );
+ }
+
+ public function getName()
+ {
+ return 'propel';
+ }
+
+ public function getConnectionName()
+ {
+ return $this->data['connectionName'];
+ }
+}
Binary file not shown.
@@ -0,0 +1,29 @@
+{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}
+
+{% block toolbar %}
+ {# the web debug toolbar content #}
+ {% set icon %}
+ <img alt="Propel" style="border-width: 0; vertical-align: middle; margin-right: 5px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAYAAAB2+A+pAAACzmlDQ1BJQ0MgUHJvZmlsZQAAeNqNk8trFFkUh7/q3KCQIAy0r14Ml1lIkCSUDzQiPtJJbKKxbcpEkyBIp/p2d5mb6ppb1XEUEcnGpc4we/GxcOEf4MKFK90oEXwhiHsVRRTcqLSL6nRX8HlWX/3Oub9zzi0udNrFINApCXN+ZJxcVk5OTcsVz0ixni4ydBXdMBgsFMYAikGg+SY+PsECeNj3/fxPo6sUunNgrYTU+5IKXej4DNQqk1PTIDSQPhkFEYhzQNrE+v9Aeibm60DajDtDIG4Bq9zARCDuAQNutViCTgH0VhI1Mwme03W3Oc8fQLfyJw4DGyB1VoUjTbYWSsXhA0A/WK9KangE6AXretnbNwr0AM/LZt9EzNZGLxodjzl1xNf5sSav82fyh5qeIoiyzpJ/OH94ZEk/UdxfADJgObO1Aw6wBlJ7T1fHj8Zs6dPVoXyTH5m6MwH8BalrgS6MxbOl7jCFRuHho/CROOTI0keAoUYZDw+NRw6Fj8LgETL73UpNIcGSHC/xeYnB42/qKCQOR8jmWehtOUj7qf3Gfmxftq/Zry9m6j3tzII57rmLF95RQGFavs1sc6bY36XGIBpNBcVca6cwMWliurJ/MdN2chcvvFPn8x8TW6pEpz5mUITMYvCYR6EJUQwmuv3o9hT67plb69q9Houbxx523z2z7K5q32ylWlst/27XJc8r8afYJEbFgNiBFHvEXrFbDIsBsVOMtU5M4ONxEoUhpIjG5xRy2f9bqiV+awCkc8pXxnOlk8vKgqmVPa0ST/QX6d+MyalpGdN0HW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 {% set text %}
+ Propel
+ |
+ <span style="color: #759e1a">{{ collector.connectionName }}</span>
+ {% endset %}
+ {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
+{% endblock %}
+
+{% block menu %}
+ {# the menu content #}
+ <span class="label">
+ <span class="icon"><img src="{{ asset('bundles/propel/images/profiler/propel.png') }}" alt="" /></span>
+ <strong>Propel</strong>
+
+
+ </span>
+{% endblock %}
+
+{% block panel %}
+ {# the panel content #}
+ {% render 'PropelBundle:Panel:configuration' with { 'collector': collector } %}
+{% endblock %}
@@ -0,0 +1,76 @@
+<h2>Propel configuration</h2>
+
+<table summary="Current Propel configuration">
+ <thead>
+ </thead>
+ <tbody>
+ <tr>
+ <th>Default connection</th>
+ <td>{{ default_connection }}</td>
+ <tr>
+ <th>Logging</th>
+ <td>{{ logging ? 'enabled' : 'disabled' }}</td>
+ </tr>
+ <tr>
+ <th>Charset</th>
+ <td>{{ charset }}</td>
+ </tr>
+ <tr>
+ <th>Propel path</th>
+ <td>{{ path }}</td>
+ </tr>
+ <tr>
+ <th>Phing path</th>
+ <td>{{ phing_path }}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2>Propel connections</h2>
+
+<table summary="Current Propel connections">
+ <thead>
+ <tr>
+ <th>Connection name</th>
+ <th colspan="2" style="text-align: center;">Configuration parameters</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for name, config in configuration.datasources %}
+ <tr>
+ <th rowspan="6" style="vertical-align: top;">
+ {{ name }}
+ {% if name == default_connection %} <em style="color: red;">(current)</em>{% endif %}
+ </th>
+ <th>Adapter</th>
+ <td>{{ config.adapter }}</td>
+ </tr>
+ <tr>
+ <th>DSN</th>
+ <td>{{ config.connection.dsn }}</td>
+ </tr>
+ <tr>
+ <th>User</th>
+ <td>{{ config.connection.user }}</td>
+ </tr>
+ <tr>
+ <th>Password</th>
+ <td>{{ config.connection.password }}</td>
+ </tr>
+ <tr>
+ <th>Class</th>
+ <td>{{ config.connection.classname }}</td>
+ </tr>
+ <tr>
+ <th>Options</th>
+ <td>
+ <ul>
+ {% for key, value in config.connection.options %}
+ <li>{{ name }} : {{ value }}</li>
+ {% endfor %}
+ </ul>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>

0 comments on commit 1ddd927

Please sign in to comment.