dqs86517 2014-09-05 19:55
浏览 46

模式工具创建 - 未找到类错误

I'm trying to learn doctrine by following this tutorial. It's the official "getting started" from doctrine website.

When it comes to generate the db-schema the tutorial suggests to use the command-line tool that ships with doctrine. The command is the following:

php vendor/bin/doctrine orm:schema-tool:create

i get the following output:

SRC_DIR="`pwd`"
cd "`dirname "$0"`"
cd "../doctrine/orm/bin"
BIN_TARGET="`pwd`/doctrine"
cd "$SRC_DIR"
"$BIN_TARGET" "$@"

and nothing happens. Please note that i used composer to install doctrine, my composer.json looks like this:

{
    "require": {
        "doctrine/orm": "2.4.*",
        "symfony/yaml": "2.*"
    },
    "autoload": {
        "psr-0": {"": "src/"}
    }
}

then i tried the following command (note the different path):

php vendor/doctrine/orm/bin/doctrine orm:schema-tool:create

it gives me a class not found error:

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in C:\xampp\htdocs\my-project\vendor\doctrine\annotations\tests\Doctrine\Tests\Common\Annotations\AbstractReaderTest.php on line 13

SO... i added the phpunit dependency to my composer.json file:

{
    "require": {
        "doctrine/orm": "2.4.*",
        "symfony/yaml": "2.*"
    },
    "require-dev": {
        "phpunit/phpunit": "4.2.*"
    },
    "autoload": {
        "psr-0": {"": "src/"}
    }
}

and re-run the command:

php vendor/doctrine/orm/bin/doctrine orm:schema-tool:create

and now i'm getting a different class not found error that i'm not able to fix:

Fatal error: Class 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll' not found in C:\xampp\htdocs\my-project\vendor\doctrine\annotations\tests\Doctrine\Tests\Common\Annotations\DocParserTest.php on line 1312

i'm pretty sure composer should handle all this mess auto-magically but it's not happening.

My ultimate goal is to be able to follow the tutorial mentioned at the beginning of my question in order to start learning doctrine ORM.

Can anyone help me to get the schema-tool create command work?

Many thanks for any help and for reading this long post!

UPDATE

I wanted to point out that i tried to run those commands with both the windows cmd (console) and with git bash - same result. Anyway, please confirm that i should use git bash to issue those commands, thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?