Symfony2 Cache Clear in Prod Fails? Using JMSDiExtraBundle?

Just a quick one out there as I saw a bunch of posts trying to get around the following error:

The error of the occurs on the cache warmup part of the clearing. After looking around people referenced a bunch of different solutions, the most popular being to do a –no-warmup. However, we wanted to try to fix the problem rather than just avoid warming the cache.

The solution fairly quick and really easy. This is using 2.1.X of Symfony and 1.3.* of the JMSDiExtraBundle. Before we had in our AppKernel.php the following:

I noticed in one of the docs for the JMSDiExtraBundle it has the JMSAopBundle in the list BEFORE JMSDiExtraBundle. We tried moving this up and had success, so the final one looked like:

Hope this saves someone some time.

Posted In: Symfony

Tags: ,

  • al3x88

    My issue was:

    STDERR: PHP Fatal error: Cannot redeclare class EnhancedProxy_73b88e6bf5989f9e4785cea753cad509a15376f1__CG__JMSSecurityExtraBundleTestsFunctionalTestBundleControllerPostController in /var/www/acme/releases/20130524152737/app/cache/pro_/jms_diextra/lookup_method_classes/JMS-SecurityExtraBundle-Tests-Functional-TestBundle-Controller-PostController.php on line 11

    and still haven’t found the way to have it working without no-warmup && warmup. Also on my local machine which the only difference is php 5.4 and not 5.3 it works fine.

  • We’ve seen some differences in the errors where it seems to be working better on 5.4. Haven’t had a chance to dig into it more yet.