[TYPO3-ect] why tx_div::makeInstance()??

Ernesto Baschny [cron IT] ernst at cron-it.de
Fri Mar 30 11:13:25 CEST 2007


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


More information about the TYPO3-team-extension-coordination mailing list