For the next
$doctrine = \Zend_Registry::get('doctrine');
$em = $doctrine->getEntityManager();
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
Get SQL to update the current schema:
$sqlArray = $tool->getUpdateSchemaSql($em->getMetadataFactory()->getAllMetadata());
Refresh Schema with Current Metadata
$res = $tool->updateSchema($em->getMetadataFactory()->getAllMetadata());
Create a diagram.
$res = $tool->createSchema($em->getMetadataFactory()->getAllMetadata());
This applies to the install script. Just create and check the db connection
$conn = $doctrine->getConnection();
$sql = "SELECT * FROM users";
try {
$stmt = $conn->query($sql);
die('Already installed');
} catch (Exception $e) {
}
Then create your circuit.
source
share