$catQuery = $db->select('name')->from($prefix . 'metas')
    ->join($prefix . 'relationships', $prefix . 'relationships.mid = ' . $prefix . 'metas.mid')
    ->where($prefix . 'relationships.cid = ?', $article['cid'])
    ->where('type = ?', 'category');
$categories = $db->fetchAll($catQuery);
$result[] = array(
    'cid' => $article['cid'],
    'title' => $article['title'],
    'slug' => $article['slug'],
    'created' => date('Y-m-d H:i:s', $article['created']),
    'authorId' => $article['authorId'],
    'tags' => array_column($tags, 'name'),
    'categories' => array_column($categories, 'name'),
    'summary' => mb_substr(strip_tags($article['text']), 0, 200) . '...',
    'text' => $article['text']
);