Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SF2 : Configure a service that gives a new object instance each time

By default a symfony 2 service gives a singleton. But in my case, I need a new object instance each time I call my service.

I look at the symfony 2 tutorial, the only thing I found is : "we'll learn later how you can configure a service that has multiple instances"...

What is the correct procedure for doing that?

like image 980
egeloen Avatar asked Jan 20 '23 07:01

egeloen


1 Answers

You can use scope="prototype"

like image 172
Koc Avatar answered Jan 22 '23 21:01

Koc