Doctrine orm 运行命令时调用取消查找函数GetEntityManager()

Doctrine orm 运行命令时调用取消查找函数GetEntityManager(),doctrine-orm,zend-framework2,composer-php,Doctrine Orm,Zend Framework2,Composer Php,我正在尝试在windows操作系统上运行命令。我使用以下命令 "vendor/bin/doctrine.bat" orm:schema-tool:create 下面是我的cli-config.php <?php // cli-config.php require_once 'bootstrap.php'; // Any way to access the EntityManager from your application $em = GetMyEntityManager();

我正在尝试在windows操作系统上运行命令。我使用以下命令

"vendor/bin/doctrine.bat" orm:schema-tool:create
下面是我的cli-config.php

<?php
// cli-config.php
require_once 'bootstrap.php';

// Any way to access the EntityManager from  your application
$em = GetMyEntityManager();

$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
    'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
    'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
我下面是参考资料


编辑我重置了标签,现在是针对ZF2的

呼叫原则更新,如下所示:

$ path/to/your/php your/zf2/public/index.php orm:schema-tool:create

注意:不要为zf2项目使用标准条令文档,有专门针对zf2条令的教程和文档。zf2中的条令行为与Symfony中的条令行为不完全相同。

GetEnttyManager或GetMyEntityManager?您可以自行配置实体管理器,然后通过GetMyEntityManager使其可用。如果您碰巧正在使用Symfony 2,那么使用S2 console命令将使您的工作更轻松。请准确标记您的框架。是Symfony 2还是ZF2?您提供的链接上确实写着“您必须根据您的特定应用程序或框架调整此代码片段,并使用它们的工具访问Doctrine EntityManager和连接资源。”@AlexP:是的,它是针对Zend Frame work 2的,但ZF2没有所述的引导代码。您可以展示一下您的引导代码吗?
$ path/to/your/php your/zf2/public/index.php orm:schema-tool:create