Le 17/03/2011 02:08, Gustavo Adrian a écrit :
Using strict="false" in all the references to services with scope="prototype" seems to ignore the problem, as suggested by the exception. The thing is that I still don't understand what could be the problem in this case. Maybe I'm doing something wrong and bypassing the error could cause major problems later. I'll expand a little the situation described before. If someone could explain why a service with scope = container can't have references to services with scope = prototype, I'd be very grateful.

My services:

"module_manager" (has many "module" services). Scope: container
"module" (has many "service" services). Scope: container
"service" (could have many "service" services): Scope: prototype

If I add strict="false" in each reference of services "service" when I add them to the "module" service, it doesn't throw the exception.

Which could be the problem if a single instantiated service (in this particular case, "module") has a reference to a service which can be instantiated many times (in this particular case, "service")?
the scope says when a service is valid. A container-scoped service is always valid (you get the same instance each time) but a prototype-scoped service is only valid once (you need to create a new instance each time). So injecting a prototype-scoped service in a container-scoped service cannot work as you will not recreate a "service" each time you get the "module" so you will use the prototype-scoped service as if it were container-scoped.

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to