demos-europe / edt

Enables your PHP application to expose its entities as REST resources using the feature rich JSON:API specification as API. How and to whom your entities are exposed is highly customizable while minimizing boilerplate code.
MIT License
2 stars 1 forks source link

Avoid redundant instantiations #170

Open joorei opened 2 months ago

joorei commented 2 months ago

To avoid having the using developer configure all dependency injections manually, DefaultProcessorConfig was introduced. It acts as some kind of dependency container to be used if no dependency injection framework (e.g. Symfony) is available or if the setup of all dependencies as Symfony services is not wanted, (e.g. to quickly try out EDT).

However, the initial implementation of DefaultProcessorConfig was done very rudimentary and it will initialize the same classes multiple times during typical usage. A better approach would be to cache the already created instances.