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

Ingo Renner ingo at typo3.org
Fri Oct 10 18:40:37 CEST 2008


Dmitry Dulepov wrote:

Hi dmitry and Steffen,

> Good point. How do we name such classes actually? We do not have any 
> single policy on it. We have t3lib_TCEMain and t3lib_TCEforms but 
> t3lib_transferData and t3lib_refIndex.
> 
> Should we use capital if class name is a single work after prefix? I.e. 
> prefix_Single and prefix_multipleWords? Makes perfect sense, doesn't it?

it's like follows, and it's again needed for the upcoming autoloader:

t3lib_Singleton
t3lib_cache_CacheManager
tx_myext_controller_MyController
tx_myext_someotherfolder_somesubfolder_TheClassInThatFolder

... the last "word" is always upper camel case

For existing classes: They stay as they are for compatability reasons 
and are considered "exceptions"


Ingo


P.S.

The prvious examples would translate to the following paths/files:

t3lib/interfaces/interface.t3lib_singleton.php (special, but defined, 
case for interfaces)
t3lib/cache/class.t3lib_cache_cachemanager.php
ext/myext/controller/class.tx_myext_controller_mycontroller.php
ext/myext/someotherfolder/somesubfolder/class.tx_myext_someotherfolder_somesubfolder_theclassinthatfolder.php

-- 
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2


More information about the TYPO3-team-core mailing list