<?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_EOL, 2)
);
dump($meta->fieldMappings);
^ 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"
]
]