0

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();
4

1 回答 1

1

Doctrine 不仅生成具有表 SEQUENCES 的实体。事实上,Doctrine 的行为是不同的,因为是否生成了 SEQUENCES 实体。

不一定每个表都是一个实体,因为一个实体可以具有可能不代表新实体的关系。

那么如何已经被使用了!

于 2013-04-03T04:40:11.857 回答