Reputation: 1065
I need to generate all the entities relationship in a database using postgresql. I can generate them using the script below. However, not all tables are generated, only those having SEQUENCES. You'd know tell me how to properly generate all tables, not just those with limited SEQUENCES?
[php]
[...]
$em->getConfiguration()->setMetadataDriverImpl(
new \Doctrine\ORM\Mapping\Driver\DatabaseDriver(
$em->getConnection()->getSchemaManager()
)
);
$cmf = new Doctrine\ORM\Tools\DisconnectedClassMetadataFactory();
$cmf->setEntityManager($em);
$metadata = $cmf->getAllMetadata();
$cme = new \Doctrine\ORM\Tools\Export\ClassMetadataExporter();
$entityGenerator = new \Doctrine\ORM\Tools\EntityGenerator();
$entityGenerator->setAnnotationPrefix("");
$exporter = $cme->getExporter('annotation', __DIR__ . '/entities');
$exporter->setEntityGenerator($entityGenerator);
$exporter->setMetadata($metadata);
$etg = new \Doctrine\ORM\Tools\EntityGenerator;
$exporter->setEntityGenerator($etg);
$exporter->export();
Upvotes: 0
Views: 424
Reputation: 1065
The Doctrine generates not only entities that have tables SEQUENCES. In fact, the behavior of Doctrine is different because having SEQUENCES or not entities are generated.
Not necessarily every table is an entity, as an entity can have relationships that may not represent a new entity.
So how was already being used works!
Upvotes: 1