3

我最近更新到 Symfony 2.7 并遇到了这个问题。它给了我这个弃用错误。

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

似乎罪魁祸首是这种配置。

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

现在在 Symfony 2.7 中执行此操作的正确方法是什么?

4

2 回答 2

4

你必须转换factory_service和参数:factory_methodfactory

ac_queue.failed.job.repository:
    class: Acme\Bundle\QueueBundle\Repository\FailedJob
    factory: [@doctrine.orm.entity_manager, getRepository]
    arguments: ['AcmeQueueBundle:FailedJob']
    public: false
于 2015-06-08T14:58:42.020 回答
1

KNPUniversity 在本文中涵盖了此弃用错误:

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

于 2015-06-03T16:13:49.483 回答