$mm = $this->modelsManager->createBuilder()
->columns([
'article_type_name' => 'typ.article_type_name',
'origin_country_id',
'destination_country_id'
])
->from(['vat' => 'm:ArticleVat', 'typ' => 'm:ArticleType']) //using implicit join with model namespace alias
->where('vat.article_type_id = typ.article_type_id')
->orderBy('vat.article_type_id') //DESC
->getQuery();
$data = $mm->execute();
// Services definition
$di->setShared('modelsManager', function() {
$mm = new \Phalcon\Mvc\Model\Manager();
//Registers shorter aliases for namespaces in PHQL statements
//public registerNamespaceAlias (mixed $alias, mixed $namespaceName)
$mm->registerNamespaceAlias('m', __NAMESPACE__ . '\Models');
return $mm;
});