小编Kor*_*emi的帖子

在cli-config.php中调用GetEntityManager()中的未定义函数

我尝试从作曲家安装doctrine2 orm,它是成功的,我设置了我的bootstrap.php,如下图所示

<?php
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(dirname(__FILE__)));
// bootstrap.php
require_once "vendor/autoload.php";

use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;

$paths = array(ROOT.DS.'library'.DS.'doctrine/entities/');
$isDevMode = false;

// the connection configuration
$dbParams = array(
'driver'   => 'pdo_mysql',
'user'     => 'root',
'password' => '',
'dbname'   => 'meso',
);

$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);

?>
Run Code Online (Sandbox Code Playgroud)

这是我的cli-config.php

<?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); …
Run Code Online (Sandbox Code Playgroud)

mapping orm doctrine entitymanager undefined-function

2
推荐指数
1
解决办法
2846
查看次数