Skip to content
Browse files

Fix the way Propel is loaded. Propel cannot be instanciated as the me…

…thod only contains static properties and methods.
  • Loading branch information...
1 parent 03f97ec commit 0b9da324267fceb08f051550ff3f430e8359ca9f @rande rande committed with willdurand Apr 5, 2011
Showing with 4 additions and 13 deletions.
  1. +1 −1 DependencyInjection/PropelExtension.php
  2. +3 −1 PropelBundle.php
  3. +0 −11 Resources/config/propel.xml
View
2 DependencyInjection/PropelExtension.php
@@ -78,7 +78,7 @@ public function load(array $configs, ContainerBuilder $container)
protected function dbalLoad(array $configs, ContainerBuilder $container)
{
if (!$container->hasDefinition('propel')) {
- $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
+ $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('propel.xml');
}
View
4 PropelBundle.php
@@ -15,7 +15,9 @@ public function boot()
set_include_path($this->container->getParameter('propel.phing_path').'/classes'.PATH_SEPARATOR.get_include_path());
}
- $this->container->get('propel');
+ \Propel::setConfiguration($this->container->get('propel.configuration'));
+ \Propel::setLogger($this->container->get('propel.logger'));
+ \Propel::initialize();
}
/**
View
11 Resources/config/propel.xml
@@ -5,23 +5,12 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
- <parameter key="propel.class">Propel</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>
</parameters>
<services>
- <service id="propel" class="%propel.class%">
- <call method="setConfiguration">
- <argument type="service" id="propel.configuration" />
- </call>
- <call method="setLogger">
- <argument type="service" id="propel.logger" />
- </call>
- <call method="initialize" />
- </service>
-
<service id="propel.configuration" class="%propel.configuration.class%" />
<service id="propel.logger" class="%propel.logger.class%">

0 comments on commit 0b9da32

Please sign in to comment.
Something went wrong with that request. Please try again.