通过 CLI 的 ZF3 Doctrine - 缺少 cli-config.php 文件

ZF3 Doctrine via CLI - missing cli-config.php file

我将 ZF3 与 Doctrine 一起使用,当我执行命令时./vendor/bin/doctrine 查看可能的命令,我将其视为错误:

You are missing a "cli-config.php" or "config/cli-config.php" file in your project, which is required to get the Doctrine Console working. You can use the following sample as a template:

<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;

// replace with file to your own project bootstrap
require_once 'bootstrap.php';

// replace with mechanism to retrieve EntityManager in your app
$entityManager = GetEntityManager();

return ConsoleRunner::createHelperSet($entityManager);

有谁知道如何解决这个问题?

改用./vendor/bin/doctrine-module

您使用的命令是在您不将 Doctrine 用作 ZF3 MODULE 时使用的,但可以说是普通 PHP 项目中的一个工具.

与在 Symfony 中使用 php bin/console doctrine:* 相同。

Documentation here