Doctrine automatically create all the database tables?

前端 未结 2 962
天涯浪人
天涯浪人 2020-12-31 16:40

is there any way to tell doctrine automaticaly create schema tables without using this command :

doctrine:schema:update --force
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 17:32

    Using SchemaTool and EntityManager you can do this:

    $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
    $classes = $entityManager->getMetadataFactory()->getAllMetadata();
    $schemaTool->createSchema($classes);
    

提交回复
热议问题