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.

Query Error

So i have an Multi apllication phalcon project and i'mtrying to execute this code on my controller :

use \Manager\Models\Team as Team,
    \Manager\Models\Users as Users,
    \Manager\Models\Departments as Departments;

  $params = [
       'models'     => ['Users'],
       'columns'    => ['email','permission','name','image','department'],
    $builder = new \Phalcon\Mvc\Model\Query\Builder($params);
    $builder->innerJoin('Team', 'Team.uid = Users._');
    $builder->innerJoin('Departments', 'Team.department_id = Departments._');
    $v = $this->modelsManager->createQuery($builder->getPhql())->execute();



But i get the following error : Model 'Users' could not be loaded

how can i fix this ?


In query builder you have to use model names with namespaces!

Instead of User write Manager\Models\Users Instead of Team write Manager\Models\Team Instead of Departments write Manager\Models\Departments