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.
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.
See the documentation on the Concrete 5.7+ autoloading here:
http://www.concrete5.org/documentation/developers/5.7/environment/a...
http://www.concrete5.org/documentation/developers/5.7/environment/a...
@exchangecore
Sweet. Thanks for that link.
Sweet. Thanks for that link.
I have the same problem. In 5.7.3 everything worked as moved to 5.7.4 says "Class not found".
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).
Here are the requirements for PSR-4 which pretty much explains your class naming issue.
http://www.php-fig.org/psr/psr-4/...