[TYPO3-core] RFC #9520: add a scheme to support singletons with t3lib_div::makeInstance

Francois Suter fsuter at cobweb.ch
Tue Oct 14 21:13:55 CEST 2008


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.

Cheers

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-team-core mailing list