[TYPO3-core] RFC #10497: Mark t3lib_div::makeInstanceClassName() as deprecated

Patrick Broens patrick at netcreators.com
Mon Mar 2 14:36:37 CET 2009


What's the fuzz about? It does not break any extension.
makeInstanceClassName() is only marked as deprecated, it's still
available. We have a lot of deprecated functions in the core for
backwards compatibility. The solution for makeInstance() is well written
and doesn't break anything either. We need the check for t3lib_Singleton.

You don't have to rewrite anything in your extension, but when you use
the new functionality of makeInstance(), you have to make your extension
dependending on 4.3 >= anyway.

Patrick


Dmitry Dulepov wrote:
> Hi!
> 
> Dmitry Dulepov wrote:
>> Hi!
>>
>> Martin Kutschker wrote:
>>> You can now use t3lib_div::makeInstance() with parameters.
>> How will it help avoid breaking extensions?
> 
> I mean that this is not really acceptable:
> 
> ==============
> if (version_compare(TYPO3_branch, '4.3', '>=')) {
> 	$instance = t3lib_div::makeInstance('tx_myext_class', $param);
> }
> else {
> 	$className = t3lib_div::makeInstanceClassName('tx_myext_class');
> 	$instance = new $className($param);
> }
> ==============
> 
> There are extensions where the "else" code is used many times (20 or more times). Replacing them all with the code above only complicates the code. It does not provide any benefit. In addition reflection is slow in PHP. makeInstance() with parameters uses reflection. So it is a performance killer.
> 
> Only disadvantages than. "Phe" as Steve Jobs said once.
> 


More information about the TYPO3-team-core mailing list