我试图在不传递symfony结构的情况下更新我的数据库架构。 php bin / console doctrine:schema:update --force
因为我在自定义php应用程序中使用了doctrine 我有一个返回实体管理器的静态函数:
$paths = array("services/Entity");
$isDevMode = true;
// the connection configuration
$dbParams = array(
'host' => '',
'port' => '',
'driver' => '',
'user' => '',
'password' => '',
'dbname' => '',
'charset' => 'UTF8',
);
$config = \Doctrine\ORM\Tools\Setup::createConfiguration($isDevMode,"cache/Proxies");
$driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(new \Doctrine\Common\Annotations\AnnotationReader(), $paths);
// registering noop annotation autoloader - allow all annotations by default
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');
$config->setMetadataDriverImpl($driver);
//$entityManager = \Doctrine\ORM\EntityManager::create($dbParams, $config);
$entityManager = \Doctrine\ORM\EntityManager::create($dbParams, $config);
return $entityManager;
我在我的实体中使用注释。
感谢
答案 0 :(得分:1)