Can it help?
<?php
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Console\Helper\Table;
class EntitylistCommand extends Command
{
protected static $defaultName = 'EntitylistCommand';
protected function configure()
{
$this
->setDescription('EntitylistCommand')
->setHelp('EntitylistCommand');
}
public function __construct(ObjectManager $em)
{
$this->em = $em;
// you *must* call the parent constructor
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output)
{
/* @var $em \Doctrine\ORM\EntityManager */
$em = $this->em;
$tables = $em->getMetadataFactory()->getAllMetadata();
foreach ($tables as $table) {
$tablename = $table->getName();
echo $tablename . PHP_EOL;
$metadata = $em->getClassMetadata($tablename);
$fields = $metadata->getFieldNames();
$rows = array();
foreach ($fields as $field) {
$fieldinfo = $metadata->fieldMappings[$metadata->getFieldName($field)];
$fieldname = $fieldinfo["fieldName"];
$fieldcolumnname = $fieldinfo["columnName"];
$fieldnullable = (isset($fieldinfo["nullable"]) ? ($fieldinfo["nullable"] ? "yes" : "no") : "no");
$fieldlength = (isset($fieldinfo["length"]) ? " (" . $fieldinfo["length"] . ")" : "");
$fieldtype = (isset($fieldinfo["type"]) ? $fieldinfo["type"] : "");
$rows[] = array($fieldname, $fieldtype . $fieldlength, $fieldcolumnname, $fieldnullable);
}
$table = new Table($output);
$table
->setHeaders(['Field', 'Type', 'Column', 'Nullable', 'Constraints'])
->setRows($rows)
;
$table->render();
}
}
}
FOS\UserBundle\Model\User
+---------------------+--------------+-----------------------+----------+-------------+
| Field | Type | Column | Nullable | Constraints |
+---------------------+--------------+-----------------------+----------+-------------+
| username | string (180) | username | no | |
| usernameCanonical | string (180) | username_canonical | no | |
| email | string (180) | email | no | |
| emailCanonical | string (180) | email_canonical | no | |
| enabled | boolean | enabled | no | |
| salt | string | salt | yes | |
| password | string | password | no | |
| lastLogin | datetime | last_login | yes | |
| confirmationToken | string (180) | confirmation_token | yes | |
| passwordRequestedAt | datetime | password_requested_at | yes | |
| roles | array | roles | no | |
+---------------------+--------------+-----------------------+----------+-------------+