Doctrine 2 Command line print Cygwin configuration

笑着哭i 提交于 2020-02-27 08:27:27

问题


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" "$@"

My folder structure:

src/
vendor/
bootstrap.php
cli-config.php
composer.json
composer.lock
index.php

bootstrap.php

<?php

require_once "vendor/autoload.php";

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

$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

<?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);

I am trying to use in my command line: php vendor/bin/doctrine --help. I am using also Vagrant with Ubuntu 14.01.

I am not using Symfony 2, Just trying to install Doctrine without any framework.

Thank you.


回答1:


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

Source: http://www.agevaled.com/2013/10/09/doctrine2-getting-started-issues/2147483647/



来源:https://stackoverflow.com/questions/33416661/doctrine-2-command-line-print-cygwin-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!