Skip to content

Commit

Permalink
Injected propel.configuration service in the collector
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Apr 8, 2011
1 parent 0047ffe commit 28efb08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 10 additions & 4 deletions DataCollector/PropelDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,24 @@ class PropelDataCollector extends DataCollector
* @var string
*/
private $connectionName;
/**
* Propel configuration
*
* @var \PropelConfiguration
*/
protected $propelConfiguration;

/**
* Constructor
*
* @param \Propel\PropelBundle\Logger\PropelLogger $logger A PropelLogger
* @param string $connectionName A connection name
*/
public function __construct(\Propel\PropelBundle\Logger\PropelLogger $logger, $connectionName)
public function __construct(\Propel\PropelBundle\Logger\PropelLogger $logger, $connectionName, \PropelConfiguration $propelConfiguration)
{
$this->logger = $logger;
$this->connectionName = $connectionName;
$this->propelConfiguration = $propelConfiguration;
}

/**
Expand Down Expand Up @@ -70,9 +77,8 @@ private function buildQueries()
{
$queries = array();

$config = \Propel::getConfiguration(\PropelConfiguration::TYPE_OBJECT);
$outerGlue = $config->getParameter('debugpdo.logging.outerglue', ' | ');
$innerGlue = $config->getParameter('debugpdo.logging.innerglue', ': ');
$outerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.outerglue', ' | ');
$innerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.innerglue', ': ');

foreach($this->logger->getQueries() as $q)
{
Expand Down
3 changes: 2 additions & 1 deletion Resources/config/propel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="propel.dbal.default_connection">default</parameter>
<parameter key="propel.configuration.class">PropelConfiguration</parameter>
<parameter key="propel.logger.class">Propel\PropelBundle\Logger\PropelLogger</parameter>
<parameter key="propel.dbal.default_connection">default</parameter>
<parameter key="propel.data_collector.class">Propel\PropelBundle\DataCollector\PropelDataCollector</parameter>
</parameters>

Expand All @@ -23,6 +23,7 @@
<tag name="data_collector" template="PropelBundle:Collector:propel" id="propel" />
<argument type="service" id="propel.logger" />
<argument>%propel.dbal.default_connection%</argument>
<argument type="service" id="propel.configuration" />
</service>
</services>
</container>

0 comments on commit 28efb08

Please sign in to comment.