<?php

namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * TaxonomyNodeRepository
 *
 * This class was generated by the PhpStorm "Php Annotations" Plugin. Add your own custom
 * repository methods below.
 */
class TaxonomyNodeRepository extends EntityRepository
{
    public function getDatabases($fennec_id){
        $qb = $this->getEntityManager()->createQueryBuilder();
        $qb->select('t.taxonomyNodeId', 'db.name')
            ->from('AppBundle\Entity\TaxonomyNode', 't')
            ->innerJoin('AppBundle\Entity\Db','db','WITH', 't.db = db.dbId')
            ->where('t.fennec = :fennec_id')
            ->setParameter('fennec_id', $fennec_id);
        $query = $qb->getQuery();
        $result = $query->getArrayResult();

//        $result = array();
//        while($row = $stm_get_taxonomy_databases->fetch(PDO::FETCH_ASSOC)){
//            $result[$row['name']] = $row['taxonomy_node_id'];
//        }
//        return $result;
    }

    public function getLineage(){

    }
}

<?php

namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * TaxonomyNodeRepository
 *
 * This class was generated by the PhpStorm "Php Annotations" Plugin. Add your own custom
 * repository methods below.
 */
class TaxonomyNodeRepository extends EntityRepository
{
    public function getDatabases($fennec_id){
        $qb = $this->getEntityManager()->createQueryBuilder();
        $qb->select('t.taxonomyNodeId', 'db.name')
            ->from('AppBundle\Entity\TaxonomyNode', 't')
            ->innerJoin('AppBundle\Entity\Db','db','WITH', 't.db = db.dbId')
            ->where('t.fennec = :fennec_id')
            ->setParameter('fennec_id', $fennec_id);
        $query = $qb->getQuery();
        $data = $query->getArrayResult();

        $result = array();
        for($i=0;$i<sizeof($data);$i++){
            $result[$data[$i]['name']] = $data[$i]['taxonomyNodeId'];
        }
        return $result;
    }

    public function getLineage(){

    }
}

Add for loop in order to get correct structure of data
Add for loop in order to get correct structure of data
