symfony - Using a Factory to Create Services with symfony2.7 -
how use factory create services symfony2.7 ?
#service.yml #in symfony 2.6 my.repository.photo: class: my\appbundle\repository\photorepository factory_method: getrepository factory_service: doctrine arguments: [my\appbundle\entity\photo] #i have errors deprecated: symfony\component\dependencyinjection\definition::setfactorymethod(getrepository) deprecated since version 2.6 , removed in 3.0. use definition::setfactory() instead. in /my/vendor/symfony/symfony/src/symfony/component/dependencyinjection/definition.php on line 137 deprecated: symfony\component\dependencyinjection\definition::setfactoryservice(doctrine) deprecated since version 2.6 , removed in 3.0. use definition::setfactory() instead. in my/vendor/symfony/symfony/src/symfony/component/dependencyinjection/definition.php on line 208
how use "setfactory" method in case ? docs: http://symfony.com/doc/master/components/dependency_injection/factories.html
thanks!
i think related documentation clear. try configuration:
my.repository.photo: class: my\appbundle\repository\photorepository factory: ["@doctrine", getrepository] arguments: [my\appbundle\entity\photo]
deprecated errors preparation upcomming symfony 3.0. features (like factory_service|factory_method) removed. here thread can find solutions to disabling symfony deprecated errors if don't need it.
Comments
Post a Comment