[TYPO3-dev] Adding parameters to t3lib_div::makeInstance

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Sat Oct 27 11:57:05 CEST 2007


Sebastian Böttger schrieb:
> Hi,
> 
> I just came across three bug issues posted by Dmitry in the bug tracker.
> 
> 0006487: tx_commerce_category does not use t3lib_div::makeInstance
> Line 436:
> 
> $category= new tx_commerce_category($oneCategoryUid,$this->lang_uid);
> 
> and two analogous issues.
> The problem is, that
> 
> tx_commerce_category
> 
> needs params for the contructor to work.
> Imho there s nothing to be said against adding the possibility of 
> parameters to t3lib_div::makeInstance.

You can use t3lib_makeInstanceClassName() to get the real name and call 
that.

eg

$myClassName = t3lib_makeInstanceClassName('MyClass');
$myObj = new $myClassName('argument');

Masi




More information about the TYPO3-dev mailing list