Autoloading in 5.7.4

Permalink
Does anyone understand how autoloading works in Concrete 5.7(.4) ? I can't wrap my head around it. I thought I got it in 5.7.3 and now they changed stuff in 5.7.4.

I get the impression the autoloader looks only for certain folders in your package (/controllers, etc) and doesn't try to resolve the location by parsing the full class name. It does look like 5.7.4. is looking in a 'Src'-folder in your package (this wasn't the case in 5.7.3.). So classes in this folder do get autoloaded but not if they have underscores. So a class 'Test' in /my_package/src/test.php will be autoloaded but class 'TestTest' in /my_package/src/test_test.php won't.

I can't find any documentation concerning the issue.

Justin1978
View Replies:
Phallanx replied on at Permalink Reply
Phallanx
They always say that 5.7 uses a modified PSR-4 autoloader although they never quite say what those modifications are or why they modified it.

Here are the requirements for PSR-4 which pretty much explains your class naming issue.
http://www.php-fig.org/psr/psr-4/...
exchangecore replied on at Permalink Reply
exchangecore
See the documentation on the Concrete 5.7+ autoloading here:
http://www.concrete5.org/documentation/developers/5.7/environment/a...
Phallanx replied on at Permalink Reply
Phallanx
@exchangecore

Sweet. Thanks for that link.
guyasyou replied on at Permalink Reply
guyasyou
I have the same problem. In 5.7.3 everything worked as moved to 5.7.4 says "Class not found".
Justin1978 replied on at Permalink Reply
Justin1978
Hmmm, I figured it out, I think. Filenames now need to be camelcased just like the class names. Foldernames however still need to be lowercase. Classes need to be placed in the Src-folder (except for controllers and some other classes).