【问题标题】:Doctrine : How to update schema without symfony教义:如何在没有 symfony 的情况下更新模式
【发布时间】:2017-05-31 16:37:18
【问题描述】:

我正在尝试更新我的数据库架构而不从 symfony 结构传递。 php bin/console 原则:schema:update --force

因为我在自定义 php 应用程序中使用了学说 我有一个返回实体管理器的静态函数:

$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;

我在我的实体中使用注释。

谢谢

【问题讨论】:

    标签: installation doctrine


    【解决方案1】:

    你可以找到命令

    $ vendor/bin/doctrine orm:schema-tool:update --force --dump-sql
    

    在教义的getting started 指南中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-26
      • 1970-01-01
      • 1970-01-01
      • 2015-11-29
      • 2012-11-24
      • 1970-01-01
      • 2021-04-05
      相关资源
      最近更新 更多