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

Class from model always not found

Hi All,

Below are my setup on my local:

Service // Simple database connection to localhost

$di->set('mongo', function () { $mongo = new MongoClient(); return $mongo->selectDB("store"); }, true);

$di->set('collectionManager', function(){ return new Phalcon\Mvc\Collection\Manager(); }, true);


class Robots extends \Phalcon\Mvc\Collection { public $name; public $year; }

Controller class RobotsController extends ControllerBase { public function initialize() { $this->tag->setTitle('Data from MongoDb');

public function indexAction()
    $return = array();

    //with error of class robots not found
     $result = Robots::find();

    //below works
    $result = $this->mongo->robots->find();   

    foreach ($result as $way){
        $return = $way;

    return $return;

If i use $robots = new Robots(); the error also occur. Please help me on which part am i doing wrong.

Thank you in advanced

I'm guessing it's a problem with namespaces. How did you register your namespaces, mainly models?

I think, you haven't registered namespace yet or your namespace was false