Symfony2 service is not a single
I am building a simple pastebin web application on top of Symfony2, but I cannot make a global / singleton / "container scope". I am probably wrong.
The symfony2 service container add-on says that services are "created only once and the same instance is returned every time you request a service" but my service constructor is called on every request.
I can verify this quite easily from the logs. I just update
and I see another
[2012-03-31 21:32:56] app.INFO: InMemoryPasteService::__construct()  
I have also verified by logging the result
In controller (and hash is different for every request).
The environment (app / prod) doesn't seem to matter.
I started with the standard (no vendor) Symfony distribution 2.0.12.
Possibly similar messages:
- Symfony2 Service Container - returns () returned objects by reference or copy?
- How does a service container create an object declared in services.yml?
source to share