【发布时间】:2016-06-08 08:01:24
【问题描述】:
我是 Symfony2 的新手,现在已经工作了将近 3 周。
一切进展顺利,但无论使用何种实体,我在每个页面上都有 4 个不推荐使用的警告,需要学说进行交互(映射是通过 yaml 文件完成的)。
将文件名传递给 Symfony\Component\Yaml\Yaml::parse 方法自版本以来已弃用 2.2 并将在 3.0 中删除。而是传递文件的 YAML 内容。 (4次)
我不知道我做错了什么,或者是否有问题我可以修复以消除警告。
感谢您的帮助!
以防万一,这里是完整的堆栈跟踪:
Yaml::parse() (called from YamlDriver.php at line 712)
YamlDriver::loadMappingFile() (called from FileDriver.php at line 115)
FileDriver::getElement() (called from YamlDriver.php at line 55)
YamlDriver::loadMetadataForClass() (called from MappingDriverChain.php at line 102)
MappingDriverChain::loadMetadataForClass() (called from ClassMetadataFactory.php at line 116)
ClassMetadataFactory::doLoadMetadata() (called from AbstractClassMetadataFactory.php at line 332)
AbstractClassMetadataFactory::loadMetadata() (called from AbstractClassMetadataFactory.php at line 216)
AbstractClassMetadataFactory::getMetadataFor() (called from EntityManager.php at line 265)
EntityManager::getClassMetadata() (called from DefaultRepositoryFactory.php at line 67)
DefaultRepositoryFactory::createRepository() (called from DefaultRepositoryFactory.php at line 50)
DefaultRepositoryFactory::getRepository() (called from EntityManager.php at line 665)
EntityManager::getRepository() (called from UserManager.php at line 40)
UserManager::__construct() (called from appDevDebugProjectContainer.php at line 1582)
appDevDebugProjectContainer::getFosUser_UserManagerService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 3632)
appDevDebugProjectContainer::getFosUser_UserProvider_UsernameService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 3690)
appDevDebugProjectContainer::getSecurity_Authentication_ManagerService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 2299)
appDevDebugProjectContainer::getSecurity_Firewall_Map_Context_MainService() (called from Container.php at line 312)
Container::get() (called from classes.php at line 2964)
FirewallMap::getListeners() (called from classes.php at line 2606)
Firewall::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 HttpKernel.php at line 120)
HttpKernel::handleRaw() (called from HttpKernel.php at line 62)
HttpKernel::handle() (called from ContainerAwareHttpKernel.php at line 69)
ContainerAwareHttpKernel::handle() (called from Kernel.php at line 185)
Kernel::handle() (called from app_dev.php at line 30)
如果需要,composer.phar show --installed的结果
doctrine/annotations v1.2.7 Docblock Annotations Parser
doctrine/cache v1.5.4 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.3.0 Collections Abstraction library
doctrine/common v2.5.3 Common Library for Doctrine projects
doctrine/dbal v2.5.4 Database Abstraction Layer
doctrine/doctrine-bundle 1.6.2 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.0 Symfony Bundle for Doctrine Cache
doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm v2.4.8 Object-Relational-Mapper for PHP
friendsofsymfony/user-bundle v1.3.6 Symfony FOSUserBundle
incenteev/composer-parameter-handler v2.1.2 Composer script handling your ignored parameter file
ircmaxell/password-compat v1.0.4 A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
monolog/monolog 1.17.2 Sends your logs to files, sockets, inboxes, databases and various web services
paragonie/random_compat v1.2.0 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
psr/log 1.0.0 Common interface for logging libraries
sensio/distribution-bundle v5.0.4 Base bundle for Symfony Distributions
sensio/framework-extra-bundle v3.0.13 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v3.0.5 This bundle generates code for you
sensiolabs/security-checker v3.0.2 A security checker for your composer.lock
swiftmailer/swiftmailer v5.4.1 Swiftmailer, free feature-rich PHP mailer
symfony/monolog-bundle v2.8.2 Symfony MonologBundle
symfony/phpunit-bridge v2.8.2 Symfony PHPUnit Bridge
symfony/polyfill-intl-icu v1.1.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.1.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php54 v1.1.0 Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions
symfony/polyfill-php55 v1.1.0 Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions
symfony/polyfill-php56 v1.1.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.1.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.1.0 Symfony utilities for portability of PHP codes
symfony/security-acl v2.8.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony v2.8.2 The Symfony PHP framework
twig/twig v1.24.0 Twig, the flexible, fast, and secure template language for PHP
编辑
按照建议,在解决了一些依赖问题之后,我将 Doctrine 升级到了 2.5。
现在我只有 2 条通知,关于安全方面的内容,我目前正在处理这些内容,基于已弃用的教程。评论故障线路使通知消失。万岁!
【问题讨论】:
-
可能需要更新到 Doctrine 2.5。我要做的是为我使用的任何版本创建一个新的 Symfony 应用程序,检查供应商版本并相应地更新 composer.json。
-
我试过了,现在我只有 2 个弃用通知。 2 次刷新后,我猜是因为安全和会话有问题(28 弃用警告)。我将使用新信息进行编辑。
-
其实就是进步。 2.8 是向 3.0 的过渡。确保您的所有捆绑包都符合 2.8 的预期,然后卷起袖子开始阅读通知。或者回到2.7。 FOSUserBundle 将成为您的大问题。以及所有表单内容。
-
目前,除了我写的一些不推荐使用的东西外,没有任何通知,我很容易修复。你的教义升级成功了,谢谢@Cerad