so i'm trying to use alias but the following code dose not work for some reason , any ideias ?
Services.php
$di['modelsmanager'] = function (){
$manager = new ModelsManager();
$manager->registerNamespaceAlias("Users", "Manager\Models\Users");
$manager->registerNamespaceAlias("Logs", "Manager\Models\Logs");
return $manager;
};
IndexController
public function testaction()
{
$this->view->disable();
var_dump($this->modelsmanager->getNamespaceAliases());
$Logs = Logs::query()
->columns([
"Logs.user",
"Logs.description"
])
->execute();
var_dump($Logs);
}
Results:
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]