From 28efb0872adaf98e980d737d78247e05fd4a439b Mon Sep 17 00:00:00 2001 From: William DURAND Date: Fri, 8 Apr 2011 13:20:03 +0200 Subject: [PATCH] Injected propel.configuration service in the collector --- DataCollector/PropelDataCollector.php | 14 ++++++++++---- Resources/config/propel.xml | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/DataCollector/PropelDataCollector.php b/DataCollector/PropelDataCollector.php index fbf9b40a..bdd096a6 100644 --- a/DataCollector/PropelDataCollector.php +++ b/DataCollector/PropelDataCollector.php @@ -25,6 +25,12 @@ class PropelDataCollector extends DataCollector * @var string */ private $connectionName; + /** + * Propel configuration + * + * @var \PropelConfiguration + */ + protected $propelConfiguration; /** * Constructor @@ -32,10 +38,11 @@ class PropelDataCollector extends DataCollector * @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; } /** @@ -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) { diff --git a/Resources/config/propel.xml b/Resources/config/propel.xml index b4c9d694..feb0fc1b 100644 --- a/Resources/config/propel.xml +++ b/Resources/config/propel.xml @@ -5,9 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + default PropelConfiguration Propel\PropelBundle\Logger\PropelLogger - default Propel\PropelBundle\DataCollector\PropelDataCollector @@ -23,6 +23,7 @@ %propel.dbal.default_connection% +