Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Latest pHalcon, no loader->registerPrefixes and load of old code

Hello,

Last year I'm busy with non IT projects.

Anyway today I start to new project, setup brand new Debian with latest pHalcon, point my last project, then

"PHP message: PHP Fatal error: Call to undefined method Phalcon\Loader::registerPrefixes() in /var/www/project/bootstrap.php "

My entire codebase configured around registerPrefixes and it seems it was removed (why ??) from phalcon 2.1

So I'm dead on water, is there any workaround

My best regards



29.9k
Accepted
answer

Hi,

you may implement that method in your own loader that extends Phalcon\loader

edited Apr '17

Yes, use namespaces. It was removed because it was deprecated.



5.4k

Thanks, finally I put some custom autoloader function.

My editor does not autofind name spaces. SO every time I create a controller I have to have check tons of namespaces by manually. So I left using namespaces long ago. Probably I have change my editor but any way I'm old person (by programmer standards). I don't want to change too much in too small time.

However I do not understand why it was deprecated ?

edited Apr '17

Because prefixes loading is not efficient and also it was bad and old way to use it. Then i would suggest changing your editor for example to Visual Studio Code or even better to full IDE like PhpStorm.