不推荐使用将文件名传递给Symfony \ Component \ Yaml \ Yaml :: parse方法的功能

时间:2016-02-25 13:47:05

标签: symfony doctrine yaml

我是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个通知,关于来自安全的内容,我目前正在处理的内容,基于一个已弃用的教程。评论错误的线条通知消失。万岁!

2 个答案:

答案 0 :(得分:2)

根据Cerad的建议,我通过编辑composer.json并运行composer update升级到Doctrine 2.5。

这会产生新的通知,但与我以不赞成使用的方式编写的安全内容有关,很容易修复。

对于遇到同样问题的人,请小心你的composer.json,Doctrine 2.5需要php 5.4,有些config.platform.php对我来说设置为5.3.9,这阻止了更新。如果要升级,也要编辑它。

答案 1 :(得分:0)

  

已删除将文件名传递给Yaml :: parse()的功能。   之前:Yaml :: parse($ fileName);   之后:Yaml :: parse(file_get_contents($ fileName));

源: https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md#yaml

可能你没有使用明确的Yaml :: parse。在您想要升级到3.0之前,这不是问题。如果您愿意,除了依赖项(可能是doctrine-bridge)所涵盖的更改之外。如果不是,你应该坚持使用2.7 LTS版本的Symfony。

我刚刚检查过2.8也是LTS。我不确定有什么区别。