Read class metadata of your Doctrine entities

Code
<?php

use PHPSnippets\Db\Entity\Test;
use 
Doctrine\ORM\EntityManager;

// ... create EntityManager

$meta $entityManager->getClassMetadata(Test::CLASS);

echo 
sprintf(
    
'SELECT %s FROM %s;%s',
    
implode(', '$meta->columnNames),
    
$meta->table['name'],
    
str_repeat(PHP_EOL2)
);

dump($meta->fieldMappings);
Result
SELECT id, name, creation_date FROM test;

array:3 [
"id" => array:9 [
"fieldName" => "id"
"type" => "integer"
"scale" => 0
"length" => null
"unique" => false
"nullable" => false
"precision" => 0
"columnName" => "id"
"id" => true
]
"name" => array:8 [
"fieldName" => "name"
"type" => "string"
"scale" => 0
"length" => 255
"unique" => false
"nullable" => false
"precision" => 0
"columnName" => "name"
]
"creationDate" => array:8 [
"fieldName" => "creationDate"
"type" => "datetime"
"scale" => 0
"length" => null
"unique" => false
"nullable" => true
"precision" => 0
"columnName" => "creation_date"
]
]
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6