我想降级Doctrine Orm 2.5到2.4用于解决此错误:
syntax error, unexpected '[', expecting ')'
注意:我的PHP版本:5.3(php 5.4及更高版本需要Doctrine 2.5)
在Composer.json文件中编写此代码:
{
"require": {
"doctrine/common": "2.4.*",
"doctrine/dbal": "2.4.*",
"doctrine/orm": "2.4.*"
}
}
使用此代码在cmd中运行composer任务:
composer install
但作曲家下载Doctrine 2.5
如何使用Composer下载Doctrine 2.4
答案 0 :(得分:0)
我刚刚进行了快速测试,下载了2.4
只需将此composer.json
放入运行composer install
:
{
"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