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

Models Manager

so i'm trying to use alias but the following code dose not work for some reason , any ideias ?


$di['modelsmanager'] = function (){
    $manager = new ModelsManager();

    $manager->registerNamespaceAlias("Users", "Manager\Models\Users");
    $manager->registerNamespaceAlias("Logs", "Manager\Models\Logs");

    return $manager;


public function testaction()

    $Logs = Logs::query()



array (size=2)
  'Users' => string '\Manager\Models\Users' (length=21)
  'Logs' => string '\Manager\Models\Logs' (length=20)
Unknown model or alias 'Logs' (11), when preparing: SELECT Logs.user, Logs.description FROM [Manager\Models\Logs]
edited Aug '16

It doesn't work like this. This is only NAMESPACE ALIAS, NOT MODEL ALIAS. It should be like this for example:

$manager->registerNamespaceAlias("M", "Manager\Models");
 $Logs = Logs::query()

But better to use query builder:

->columns(['L.user', 'L.description'])

Also for such a simple queries use ::find()

Also if coulumn name is not repeated between models then you don't need to write anything before it.