douzong5057
douzong5057
2015-06-03 16:06

Symfony 2.7中的弃用警告

已采纳

I recently updated to Symfony 2.7 and ran into this issue. It is giving me this deprecation error.

Symfony\Component\DependencyInjection\Definition::setFactoryMethod(getRepository) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead

Symfony\Component\DependencyInjection\Definition::setFactoryService(doctrine.orm.entity_manager) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead

Seems like culprit is this configuration.

ac_queue.failed.job.repository:
    class: Acme\Bundle\QueueBundle\Repository\FailedJob
    factory_service: doctrine.orm.entity_manager
    factory_method: getRepository
    arguments: ['AcmeQueueBundle:FailedJob']
    public: false

What is the right way to do this now in Symfony 2.7 now?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • doujian7132 doujian7132 6年前

    You have to transform factory_service and factory_method to the factory parameter:

    ac_queue.failed.job.repository:
        class: Acme\Bundle\QueueBundle\Repository\FailedJob
        factory: [@doctrine.orm.entity_manager, getRepository]
        arguments: ['AcmeQueueBundle:FailedJob']
        public: false
    
    点赞 评论 复制链接分享
  • dt2002 dt2002 6年前

    KNPUniversity covered this deprecation error among others in this article:

    http://knpuniversity.com/blog/upgrading-symfony-2.7#you-need-to-upgrade-sensio-distribution-bundle

    点赞 评论 复制链接分享

相关推荐