[TYPO3-core] RFC #12067: Remove ext_autoload.php files for extensions using Extbase naming convention

Xavier Perseguers typo3 at perseguers.ch
Sat Sep 26 11:11:10 CEST 2009


Hi,

> This is a SVN patch request
> 
> Type: Feature/Enhancement
> 
> Branches: trunk only
> 
> Bugtracker reference:
> http://bugs.typo3.org/view.php?id=12067
> 
> Problem:
> The use of ext_autoload.php files was once supposed to be used only for 
> old-fashioned extensions that did not used Extbase naming convention 
> (Classes directory, class component parts as subdirectories).
> 
> Nowadays, all new extensions (starting with Extbase itself) are polluted 
> with a never-ending growing ext_autoload.php file and we slowly start 
> adding all our classes there to be sure all will work fine without 
> exactly knowing what really needs to be in.
> 
> The patch allows not less than the removal of the ext_autoload.php file 
> for all extensions sticking to using only the Extbase naming convention. 
> This file may still be used for some third-party classes that may be 
> included in a pure Extbase-styled extension.
> 
> Note 1: This has nothing to do with extensions relying on Extbase 
> itself, only on its naming convention.
> Note 2: Fine-tuning of style and the rest may apply
> 
> How-to test:
> e.g., delete file EXT:extbase/ext_autoload.php and see that it still works

Thanks to Sebastian (on the MVC list), I discovered that Extbase already has its own naming-convention autoloader

[quoting Sebastian]
 > in fact, extbase has such an autoloader already in place. Have a look
 > into Utility/Autoloader (I think).
 > It is registered in the Dispatcher in the constructor method. And
 > actually I feel that this is the wrong place for it, as the automatic
 > resolving only works when the dispatcher is actually called.
 >
 > So, I'd suggest that we should find a more clever place to include the
 > autoloader instead of the Dispatcher :-)
[/quoting Sebastian]

Here is v2 which basically does the same as v1 but using similar code taken from Extbase that was then de-Extbased to fit into Core without dependency. Concerning code in Extbase, it's probable that 
it won't be needed anymore once this found its way to Core, meaning Extbase will be able to be even more clean.

One side-note concerning nitpicking: Core's autoloader declares its methods with "static protected" while the rest of Core and Extbase uses "protected static" which I find much better. Please find 
enclosed another patch to clean this up once my patch has been committed.

Regards

References:
- 12067_v2.diff : new version of the RFC patch that uses "same" code as Extbase
- autoloader_cleanup.diff : replaces "static protected" by "protected static", adds missing 's' in comments, removes last empty line
- thread in MVC list: "Fluid validation: how to debug errors?"

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 12067_v2.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20090926/cbd60400/attachment.txt 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: autoloader_cleanup.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20090926/cbd60400/attachment-0001.txt 


More information about the TYPO3-team-core mailing list