Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deprecation warning in 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?

like image 504
nicholasnet Avatar asked Sep 18 '25 10:09

nicholasnet


1 Answers

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
like image 135
COil Avatar answered Sep 21 '25 01:09

COil