Doctrine 2 Command line print Cygwin configuration(Doctrine 2 命令行打印 Cygwin 配置)
问题描述
我试图在我的项目中使用 Doctrine 2,但是当我尝试访问命令行以从我的数据库中导入实体以生成文件时,它会打印来自 vendor/bin/doctrine的代码代码>
I am trying to use Doctrine 2 in my project, but when I try to access the command line to import the Entities from my database to generate the files, it print the code from vendor/bin/doctrine
dir=$(d=${0%[/\]*}; cd "$d"; cd '../doctrine/orm/bin' && pwd)
# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# Cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than /usr/bin
if [[ $(which php) == /cygdrive/* ]]; then
dir=$(cygpath -m $dir);
fi
fi
dir=$(echo $dir | sed 's/ / /g')
"${dir}/doctrine.php" "$@"
我的文件夹结构:
src/
vendor/
bootstrap.php
cli-config.php
composer.json
composer.lock
index.php
bootstrap.php
bootstrap.php
<?php
require_once "vendor/autoload.php";
use DoctrineORMToolsSetup;
use DoctrineORMEntityManager;
$paths = array("src/Entity");
$isDevMode = false;
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => '',
'password' => '',
'dbname' => '',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);
cli-config.php
cli-config.php
<?php
use DoctrineORMToolsConsoleConsoleRunner;
// 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);
我正在尝试在我的命令行中使用:php vendor/bin/doctrine --help
.我也在 Ubuntu 14.01 中使用 Vagrant.
I am trying to use in my command line: php vendor/bin/doctrine --help
. I am using also Vagrant with Ubuntu 14.01.
我没有使用 Symfony 2,只是尝试在没有任何框架的情况下安装 Doctrine.
I am not using Symfony 2, Just trying to install Doctrine without any framework.
谢谢.
推荐答案
我在安装 windows 时遇到了同样的错误,这个命令可以解决它:
I got the same error when I was in windows setup and this command worked to resolve it:
php vendor/doctrine/orm/bin/doctrine.php orm:schema-tool:create
来源:http://www.agevaled.com/2013/10/09/doctrine2-getting-started-issues/2147483647/
这篇关于Doctrine 2 命令行打印 Cygwin 配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Doctrine 2 命令行打印 Cygwin 配置
基础教程推荐
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01