We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Adding static method to model

I guess I'm making some newbie mistake here but I can't find whats wrong. I have a model to which I wanted to add static method...

use Phalcon\Mvc\Model,

class Venues extends Model {
    public function getSource() {
        return "t_venue";

    public static function geoFind($lat1, $long1, $lat2, $long2) {
        return $res;

Now when I try to call Venues::geoFind method i get message: "Caught exception: The static method "geoFind" doesn't exist on model "Venues". What am I doing wrong?


Try to reset the server: aparently, you've it right.


Well, restarting server didnt help (i use built-in php server, ubuntu). However i just created same class under new name Venues2 and it worked. Restarted server again, killed all running php processes and its still same. Venues2 works and Venues doesnt. Any ideas?


Maybe you didn't get the models folder in the autoloader (don't think so)

BTW, no more ideas.


Nah, i have models in autoloader.

Are there any cached files which phalcon could create or something like that?


I don't think so. I also have models with static methods, and all of them work perfectly.

But Phalcon has the last word.

edited Aug '14

Something is really wrong here. I just removed php files with Venues class definition at all. And i still get same error. Phalcon still "thinks" that class Venues is defined. :/

EDIT: full system reboot also did nothing. I still get this wierd error.


Maybe is something related to the built-in. But I didn't work with it yet.