We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

$loader->registerPrefixes() and accessing the classes in a view

Hi

We are testing phalcon on an existing project and are trying to access some of our old static classes from a view. We have used the registerPrefixes() function in our index.php:

<?php
$loader = new \Phalcon\Loader();
$loader->registerPrefixes(array(
    "Old_"      => APPLICATION_PATH . "/../library/Old/",
));
$loader->register();

And then we are trying to call a static function from an old class in a view as follows:

<?php
    echo Old_Repo::getData();

Should we have access to this class in the view using registerPrefixes() ?

This gives us a whitescreen with nothing in our error log.

Thanks for your advice

edited Mar '14

On your development box, in your bootstrap file index.php add this line at the begining

(new Phalcon\Debug)->listen();

and remove try/catch from this file

Maybe it help you debug your application.

Watch this video made by Phalcon https://vimeo.com/68893840



1.1k

Thanks for the link, that is very useful for debuging.



1.1k

For anyone with similar issues we had to use namespaces to access our old classes.