[TYPO3-english] Autoloader doesn't work for BE-Modules
Christian Kuhn
lolli at schwarzbu.ch
Thu Jul 14 21:17:12 CEST 2011
Hey,
On 07/12/2011 09:54 AM, hinterindien at gmx.net wrote:
> For the autoloader to correctly include a class-file, the class-name needs to be of the form: "tx_extensionName_myClassName", because only when the class needs to be declared, the autoloader reads the file typo3conf/ext/extensionName/ext_autoload.php. The name of the class contains the mandatory hint to the place, where to find the autoload-instructions.
your analysis is correct.
Here are some more information for the autoloader in 4.5 and below:
In ext_autoloader.php the returned array KEYs *must* be lowercase, even
if the real classname has uppercase characters in it.
A KEY should be of the form 'tx_myext_fooclass', where myext is the name
of the extension as it is lying around in the filesystem. Background:
The autoloader splits the given classname and guesses the extension name
'myext' from the classname. It then looks in (usually)
typo3conf/ext/myext for the ext_autoload.php file and loads it. This is
why the classname must be constructed this way (to enable the autoloader
to find the appropriate extension).
Actually this logic changed recently for 4.6 a bit: There the autoloader
loads *all* ext_autoload.php files from the loaded extension list in one
run and not on demand anymore. This way you could (if you really must,
for example for external libraries) also add files to ext_autoload.php
that do not stick to the above described naming scheme.
Regards
Christian
More information about the TYPO3-english
mailing list