[TYPO3-ect] why tx_div::makeInstance()??
Elmar HInz
elmar.hinz at team.MINUS.red.DOT.net
Fri Mar 30 13:12:16 CEST 2007
Am Fri, 30 Mar 2007 11:13:25 +0200 schrieb Ernesto Baschny [cron IT]:
> Fernando A. wrote: on 30.03.2007 10:17:
>
>> Why I should use tx_div::makeInstance() and not "new"? How can I pass
>> parameters to the constructor?
>
> Call tx_div::makeInstanceClassName() and then use "new" on the returned
> classname, where you can pass parameters.
>
>> I realized of the disadvantages of tx_div::makeInstance but what about
>> the advantages?
>
> The advantages:
>
> - you don't need to "require" the mentioned class PHP file. If you
> follow naming conventions, this will find and require_once the file for you.
>
> - but the main advantage is that this will make it possible for others
> to XCLASS your class and have that version (ux_...) used instead of
> yours. If you do a "new" on your classname, the XCLASS class will never
> be called.
>
> Cheers,
> Ernesto
Perfect
Additionally we have the possibility to extend the function
makeInstance(ClassName) by new features. Something like hooks or
caching triggering or whatever whishes will pop up in future.
Regards
Elmar
More information about the TYPO3-team-extension-coordination
mailing list