php - Symfony 2.8:ResourceInterface::isFresh() 自 2.8 起已弃用

标签 php symfony symfony-2.8

升级Symfony到2.8后,发现很多deprecation警告:

The class "Symfony\Bundle\AsseticBundle\Config\AsseticResource" is performing resource checking through ResourceInterface::isFresh(), which is deprecated since 2.8 and will be removed in 3.0 (54 times)

堆栈(来自 Symfony 分析器)

BCResourceInterfaceChecker::isFresh() (called from bootstrap.php.cache at line 3061)
ResourceCheckerConfigCache::isFresh() (called from ResourceCheckerConfigCacheFactory.php at line 45)
ResourceCheckerConfigCacheFactory::cache() (called from classes.php at line 1328)
Router::getMatcher() (called from classes.php at line 1288)
Router::match() (called from classes.php at line 7170)
Router::match() (called from classes.php at line 2086)
RouterListener::onKernelRequest()
call_user_func() (called from WrappedListener.php at line 61)
WrappedListener::__invoke()
call_user_func() (called from classes.php at line 1853)
EventDispatcher::doDispatch() (called from classes.php at line 1771)
EventDispatcher::dispatch() (called from TraceableEventDispatcher.php at line 132)
TraceableEventDispatcher::dispatch() (called from bootstrap.php.cache at line 3178)
HttpKernel::handleRaw() (called from bootstrap.php.cache at line 3151)
HttpKernel::handle() (called from bootstrap.php.cache at line 3302)
ContainerAwareHttpKernel::handle() (called from bootstrap.php.cache at line 2498)
Kernel::handle() (called from app_dev.php at line 29)

升级我用过:

composer.phar update symfony/symfony --with-dependencies

这是我的 composer.json

{
    "name": "framework/symfony",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        }
    },
    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.8.*",
        "doctrine/orm": "^2.4.8",
        "doctrine/doctrine-bundle": "~1.4",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~4.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "~2.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3"
    },
    "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"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}

如何解决这个弃用警告?

最佳答案

谷歌搜索发现:https://knpuniversity.com/screencast/symfony3-upgrade/fix-deprecations-in-bundles

他们链接到 Assetic GitHub 页面,该页面声称 2.7.1 已为 Symfony 3 做好准备。但显然不是。就这么简单。 Assetic 还没有为 symfony 3 做好准备,因此它在 2.8 中生成了很多弃用通知。 merge request to fix this尚未合并。

关于php - Symfony 2.8:ResourceInterface::isFresh() 自 2.8 起已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34138642/

相关文章:

php - 交响乐 : Ordering Entity Type Form by entity relation

php - 多选数组不发送数据

symfony - PHPUnit:不要报告呈现为 HTTP 错误的 Symfony 异常

unit-testing - 仅当在 Symfony 2.8 中进行单元测试时,服务类中的 Twig_Environment 才会导致 DIC RuntimeExtension

php - 如何使用 symfony 获取 Doctrine 实体持久集合数据值

php - 如何替换已解码的 Non-breakable space (nbsp)

php - 哪种方法更适合搜索 mysql 数据库?

symfony - Dart Packages 文件夹不再存在我现在如何与 symfony 集成以进行开发

symfony - 如何在 Symfony 中注入(inject)验证器

php - 无法使用 NetBeans IDE (8.1) 设置 Symfony2 框架