我要降级学说ORM 2.5至2.4以解决此错误:
syntax error, unexpected '[', expecting ')'
注意:我的php版本:5.3(php 5.4及以后版本需要的学说2.5)
并在composer.json文件中写下此代码:
{
"require": {
"doctrine/common": "2.4.*",
"doctrine/dbal": "2.4.*",
"doctrine/orm": "2.4.*"
}
}
和此代码中的CMD中运行Composer任务:
composer install
但作曲家下载学说2.5
如何通过作曲家下载教义2.4
我刚刚进行了快速测试,然后下载2.4
只需将此composer.json
放入一个文件夹中,一个运行 composer install
:
composer.json
{
"name": "test/test",
"description": "test",
"license": "no",
"require": {
"doctrine/common": "2.4.*",
"doctrine/dbal": "2.4.*",
"doctrine/orm": "2.4.*"
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
正如您在Composer安装输出中所看到的,doctrine/common
,doctrine/dbal
和doctrine/orm
都是版本2.4.x。我也使用"preferred-install": "source"
和"minimum-stability": "dev"
相同的结果进行测试。
composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing doctrine/lexer (v1.0.1)
Loading from cache
- Installing doctrine/annotations (v1.2.4)
Loading from cache
- Installing doctrine/collections (v1.3.0)
Loading from cache
- Installing doctrine/cache (v1.4.1)
Loading from cache
- Installing doctrine/inflector (v1.0.1)
Loading from cache
- Installing doctrine/common (v2.4.2)
Loading from cache
- Installing symfony/console (v2.6.7)
Loading from cache
- Installing doctrine/dbal (v2.4.4)
Loading from cache
- Installing doctrine/orm (v2.4.7)
Loading from cache
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/process ()
symfony/console suggests installing psr/log (For using the console logger)
doctrine/orm suggests installing symfony/yaml (If you want to use YAML Metadata Mapping Driver)
Writing lock file
Generating autoload files