Skip to content

Instantly share code, notes, and snippets.

@ThamaraHessel
Created March 28, 2013 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThamaraHessel/5265292 to your computer and use it in GitHub Desktop.
Save ThamaraHessel/5265292 to your computer and use it in GitHub Desktop.
Dúvida de Vinicius Feitosa: [Doctrine ORM 2.+]
$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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment