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