propelorm / PropelBundle

PropelBundle for Symfony.
http://propelorm.org/Propel/documentation/#working-with-symfony2
180 stars 156 forks source link

SF2.7 / SF2.8 + Propel1 / Bad propel init on first call after clear:cache #356

Open lionelbzv opened 9 years ago

lionelbzv commented 9 years ago

Env:

        "symfony/symfony": "2.7.*" or "2.8.*",
        "propel/propel-bundle": "1.4.*",

The first time I call a page or a SF command line after having clear the cache, I've got this error:

  [PropelException]                                                                      
  No connection information in your runtime configuration file for datasource [default]  

Exception trace:
 () at /var/www/project.test.2.8/vendor/propel/propel1/runtime/lib/Propel.php:583
 Propel::getMasterConnection() at /var/www/project.test.2.8/vendor/propel/propel1/runtime/lib/Propel.php:561
 Propel::getConnection() at /var/www/project.test.2.8/vendor/propel/propel-bundle/Propel/PropelBundle/Security/Acl/MutableAclProvider.php:55
 Propel\PropelBundle\Security\Acl\MutableAclProvider->__construct() at /var/www/project.test.2.8/app/cache/dev/appDevDebugProjectContainer.php:2368
 appDevDebugProjectContainer->getSecurity_Acl_ProviderService() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:312
 Symfony\Component\DependencyInjection\Container->get() at /var/www/project.test.2.8/app/cache/dev/appDevDebugProjectContainer.php:2310
 appDevDebugProjectContainer->getSecurity_Access_DecisionManagerService() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:312
 Symfony\Component\DependencyInjection\Container->get() at /var/www/project.test.2.8/app/cache/dev/appDevDebugProjectContainer.php:2420
 appDevDebugProjectContainer->getSecurity_AuthorizationCheckerService() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:312
 Symfony\Component\DependencyInjection\Container->get() at /var/www/project.test.2.8/app/cache/dev/appDevDebugProjectContainer.php:3562
 appDevDebugProjectContainer->getTwigService() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:312
 Symfony\Component\DependencyInjection\Container->get() at /var/www/project.test.2.8/app/cache/dev/appDevDebugProjectContainer.php:571
 appDevDebugProjectContainer->getCacheWarmerService() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:312
 Symfony\Component\DependencyInjection\Container->get() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:523
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:133
 Symfony\Component\HttpKernel\Kernel->boot() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/project.test.2.8/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:123
 Symfony\Component\Console\Application->run() at /var/www/project.test.2.8/app/console:29

If I recall the page or the command line, it works fine.

Someone have ideas? Thanks.

karasq commented 8 years ago

PropelBundle initializes configuration in boot method in PropelBundle.php which seems to be too late in some scenerio. I ran into the same problem when I use propel query in constructor of service that is passed to twig as global variable. Check this out for more details: http://stackoverflow.com/questions/34298976/does-symfony-2-8-load-bundles-and-services-in-correct-order-during-warmup

lionelbzv commented 8 years ago

thanks for theses explanations, but as say ryan, "In short: this looks like a quirk of Propel to me, but someone who knows more about Propel might know a way to forcefully "boot" it. Propel is special because of the static context it uses."

So, anybody in the Propel core team have advices about this "boot" issue?

lionelbzv commented 8 years ago

Same problem w. a fresh new project in SF2.8, any help welcome.

havvg commented 8 years ago

Can you provide an installation with the problem? A PR on https://github.com/havvg/symfony-propel-edition would be awesome :)