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 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8