如何使用doctrine 2从查询中获取列名?

I need to get the names of the columns in a sql query executed by doctrine 2.

This worked for me in doctrine 1.2

public function executeQuery($query, $conn) {

    /*.......*/

    $result = $conn->execute($query);

    $array_result = array();
    $long = $result->columnCount();

    while ($long > $iterator) {
        $meta = $result->getColumnMeta($iterator);
        $array_result[$iterator]['name'] = $meta['name'];
        $array_result[$iterator]['type'] = $meta['native_type'];
        $iterator++;
    }
    return $array_result;
}

I am now working with symfony 2 and doctrine 2. I need to get the name and data type fields in the SELECT clause. Example:

SELECT name, lastname FROM profile

I need to get the name and lastname fields from php using doctrine.