我正在尝试将我的项目从2.7更新到3.0
我已从https://github.com/symfony/symfony-standard/blob/v3.0.0/composer.json更新了composer.json,并添加了我在项目中使用的扩展程序
composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" },
"files": [ "app/AppKernel.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/" }
},
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.0.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"friendsofsymfony/user-bundle": "~2.0@dev",
"imagine/imagine": "~0.5.0",
"twig/extensions": "^1.3",
"doctrine/doctrine-migrations-bundle": "^1.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.0-dev"
}
}
}
我在更新时遇到下一个错误
致命错误:界面 'Symfony \ Component \ HttpKernel \ HttpKernelInterface'不在 在线C:\ OpenServer \ domains \ stereoshoots \ app \ bootstrap.php.cache 2450脚本 SENSIO \包\ DistributionBundle \作曲\ ScriptHandler :: clearCache 处理post-update-cmd事件,并以异常终止
[RuntimeException]执行时发生错误 “”cache:clear --no-warmup“”命令:致命错误:接口 找不到'Symfony \ Component \ HttpKernel \ HttpKernelInterface' l ine上的C:\ OpenServer \ domains \ stereoshoots \ app \ bootstrap.php.cache 2450。
这是解决方案吗?
答案 0 :(得分:1)
还有一些其他的东西要在composer.json文件的基础上更新。关于控制台,即返回错误的文件,您需要替换
require_once __DIR__.'/../bootstrap.php.cache';
通过
require __DIR__.'/../app/autoload.php';
在app / AppKernel.php和其他文件中有更重要的更改。更多信息:
https://knpuniversity.com/screencast/symfony3-upgrade/new-dir-structure
答案 1 :(得分:-1)
使用这些命令可以解决您的问题:
rm -rf var/cache/*
rm -rf var/logs/*
然后清除缓存产品和开发。
因为有时在升级或使用composer update时,缓存可能会保留旧引用并使清除缓存变得困难。