doctrine model schema from mysql tables
i want to create all my database tables as doctrine table schema automatically. doctrine version is 2. Can anyone please help me how to get this by php itself instead of usi开发者_StackOverflow社区ng command line tools plz? I am using codeigniter framework(2.0), so solution based on that will be much appreciated.
Regards
You need to instantiate SchemaTool. This code should work for you:
$em = $this->doctrine->em;
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
$tool->dropDatabase();
$classes = array(
$em->getClassMetadata('user')
);
$tool->createSchema($classes);
http://www.doctrine-project.org/docs/orm/2.0/en/reference/tools.html
精彩评论