2017-02-07 7 views
0

Doctrine 2をプロジェクト用の外部ライブラリとして設定しようとしています。 これをComposerでインストールし、Doctrineのドキュメントの指示に従いました。コマンドラインは機能しません。今、だから、Doctrine 2外部ライブラリとしてのコマンドライン設定

use Doctrine\ORM\Tools\Console\ConsoleRunner; 

require_once 'index.php'; // my bootstrap 



return ConsoleRunner::createHelperSet($em); 

:ここ

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

/* Instantiation of doctrine 
---------------------------------------------------------------------------------------------------------------------*/ 

$paths = array(__DIR__."/Application/Entity"); 
$isDevMode = true; 

// the connection configuration 
$dbParams = Yaml::parse(file_get_contents('Application/Config/Private/bdd.yml')); 

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

/*--------------------------------------------------------------------------------------------------------------------*/ 

は私のcli-config.phpファイルの内容である(プロジェクトルート内):ここで

は私のブートストラップで教義上の一部であり、ドキュメントでは、コンソールモードでDoctrineを使用することができると言っています。 php 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" "[email protected]" 

PHPの作業罰金を、と私は(テストコマンドラインに)symfonyプロジェクトとsymfonyとコマンドラインの仕事をインストールしようとしました。ですから、問題はDoctrineのインストール/設定から来たと思います。

私が逃したものは分かりませんが、Doctrineをコマンドラインで使用することはできません。誰かがアイデアを持っていますか?

答えて

0

あなたが呼び出しているdoctrineのコマンドは、PHPファイルではなく、シェルスクリプトです。

代わりに./vendor/bin/doctrineを呼び出し、期待どおりに動作するはずです。

+0

私は窓にあります。私がwhith "Bash Ubuntu on windows"を試してみたら、それはうまくいっています(Tanksはすでに大きなステップです)。しかし、それをWindowsのコマンドラインで動作させるにはどうすればよいですか? –

+0

'php vendor/doctrine/orm/bin/doctrine.php'または' sh vendor/bin/doctrine'を呼び出すことができます – madshvero

+0

ありがとう、ちょうど私が必要なことです。 :) –

関連する問題