Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 updating bootstrap.php.cache

Tags:

symfony

Recently I started a project in Symfony2 from the BETA version available on symfony.com

After a while, I needed to upgrade to the master branch, so I retrieved the latest from github and switched it in vendor/symfony.

However, my bootstrap.php.cache and bootstrap_cache.php.cache are not upgraded, which has generated errors.

I tried clearing the symfony cache, to no avail.

How can I update these files to correspond to my project?

like image 513
jihi Avatar asked May 20 '11 12:05

jihi


3 Answers

In the 2.0 release the original file is here:

./vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

Edit: in release 2.3 the file is here

vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
like image 96
mogoman Avatar answered Oct 13 '22 15:10

mogoman


If you run the composer update command you will also update your project dependencies which is not the desired behaviour here. If you do that you'll have to test the new changes to see if they do affect your application somehow.

So if you just want to rebuild your bootstrap cache file then I suggest you run the post-update-cmd command.

Therefore you should use:

composer run-script post-update-cmd

which in my case executes the following scripts (see composer.json):

"scripts": {
    "post-install-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrapSass"
    ]
}

Please consider that you can also create a new set of scripts in there to just rebuild the bootstrap file and clears the cache without installing the assets and so on:

"scripts": {
    "reset-bootstrap-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache"
    ]
}

and then... composer run-script reset-bootstrap-cmd

like image 33
Francesco Casula Avatar answered Oct 13 '22 15:10

Francesco Casula


In the latest 2.1.0-DEV, the actual script is here:

./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

like image 28
Gregoire Avatar answered Oct 13 '22 15:10

Gregoire