With the Symfony framework, most objects are supposed to live in the Service Container. This facilitates an “autowire” of all the class constructors, plus a great deal of magic from the debug tools.
Most objects are supposed to be “shared” as well. This is Symfony’s substitute for the singleton pattern. It helps prevent duplication of “services”. However, services don’t always fit this pattern.
One of the Symfony configuration tutorials divides object classes into only two types. In that limited example, objects would have to be “services that do work” or “models that hold data”. Again, services don’t always fit into this pattern.Continue reading Autowiring of Non-Shared Services