[TYPO3-core] RFC #9520: add a scheme to support singletons with t3lib_div::makeInstance
Martin Kutschker
masi-no at spam-typo3.org
Wed Oct 15 16:00:52 CEST 2008
Francois Suter schrieb:
> Hi,
>
>>> Let makeInstance test if an object implements the t3lib_singleton
>>> interface and if so keep a reference for later use.
>
> Actually I just realised today that services use singletons too, via a
> registry of instantiated classes stored in $T3_VAR. This actually caused
> me some trouble and it would have been nice to be able to declare some
> services as non-singleton.
>
> Unfortunately the method you propose in this patch would not be
> compatible for services, since they are expected to be all singletons,
> and requiring the singleton interface for them would break backward
> compatibility.
>
> Still using a static member variable would be nicer than a global
> variable. I'll try to remember to make a patch about that at some point.
Great! I had the same idea. Let's get rid of unnecessary globals. IIRC
there are also ones in t3lib_exec. Maybe there is more to clean up.
Masi
More information about the TYPO3-team-core
mailing list