我最近更新到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中执行此操作的正确方法是什么?
答案 0 :(得分:4)
您必须将factory_service
和factory_method
转换为factory
参数:
ac_queue.failed.job.repository:
class: Acme\Bundle\QueueBundle\Repository\FailedJob
factory: [@doctrine.orm.entity_manager, getRepository]
arguments: ['AcmeQueueBundle:FailedJob']
public: false
答案 1 :(得分:1)
KNPUniversity在本文中介绍了此弃用错误:
http://knpuniversity.com/blog/upgrading-symfony-2.7#you-need-to-upgrade-sensio-distribution-bundle