简体   繁体   English

如何在作曲家中使用Zend Framework 2的开发分支?

[英]How to use the develop branch of Zend Framework 2 over composer?

In an Apigility driven application my composer.json is looking like this: 在Apigility驱动的应用程序中,我的composer.json看起来像这样:

{
    "name": "misc - myproject-api",
    "description": "Skeleton Application for Apigility",
    "require": {
        "php": ">=5.3.23",
        "zendframework/zendframework": ">=2.3.2,<3.0.0",
        "zfcampus/zf-apigility": "~1.0",
        "zfcampus/zf-apigility-documentation": "~1.0",
        "zfcampus/zf-development-mode": "~2.0",
        "zfcampus/zf-rest": "~1.0-dev",
        "zf-commons/zfc-base": "dev-master",
        "zendframework/zend-developer-tools": "dev-master",
        "doctrine/doctrine-orm-module": "0.8.*"
    },
    "require-dev": {
        "zendframework/zftool": "dev-master",
        "zfcampus/zf-apigility-admin": "~1.0",
        "zfcampus/zf-apigility-welcome": "~1.0",
        "zfcampus/zf-deploy": "~1.0",
        "zfr/zfr-cors": "~1.0",
        "zend/zend-studio-development-mode": "~1.0"
    },
    "keywords": [
        "api",
        "apigility",
        "framework",
        "zf2"
    ],
    "support": {
        "email": "apigility-users@zend.com",
        "irc": "irc://irc.freenode.net/apigility",
        "source": "https://github.com/zfcampus/zf-apigility-skeleton",
        "issues": "https://github.com/zfcampus/zf-apigility-skeleton/issues"
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.0-dev",
            "dev-develop": "1.1-dev"
        }
    },
    "config": {
        "process-timeout": 5000
    },
    "type": "library",
    "license": "BSD-3-Clause",
    "homepage": "http://apigility.org/"
}

There is a ZF2 issue (that causes following error: Fatal error: Cannot use object of type Zend\\Db\\ResultSet\\ResultSet as array ). ZF2 问题 (导致以下错误: Fatal error: Cannot use object of type Zend\\Db\\ResultSet\\ResultSet as array )。 It has been fixed , but not merged to the master branch yet. 它已经修复 ,但尚未合并到master分支。

Since I need it working now, I tried to switch to the develop branch -- updated my composer.json 因为我现在需要它工作,所以我尝试切换到develop分支-更新了composer.json

{
    "name": "misc - myproject-api",
    "description": "Skeleton Application for Apigility",
    "require": {
        "php": ">=5.3.23",
        "zendframework/zendframework": "dev-develop as dev-master"
        ...
    }
    ...
}

and executed a composer update : 并执行了composer update

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Updating zendframework/zendframework (dev-master de98f63 => dev-develop be0b349)
    Checking out be0b3496b73a61a255d05e945b75f6fdf0995c31

Writing lock file
Generating autoload files

Problem : I'm not observing any changes, the code seems still to be loaded from the ZF2 master branch (eg my local Zend\\Paginator\\Adapter\\DbSelect has exactly the state of the according class in the master branch). 问题 :我没有观察到任何更改,代码似乎仍从ZF2 master分支加载(例如,我本地的Zend\\Paginator\\Adapter\\DbSelectmaster分支中具有相应类的状态)。

How to load the ZF2 develop branch? 如何加载ZF2 develop分支?


UPDATE UPDATE

I've triedthe the composer require direction value for the develop branch ( 2.4.*@dev ) from the Packagist page of the Zend Framework . 我已经尝试过Zend FrameworkPackagist页面中 2.4.*@devdevelop分支( 2.4.*@dev )的require方向值。 The result is the same as with dev-develop or dev-develop as dev-master -- the console shows the correct branch (or better the correct commit be0b349 ) downloading 结果与dev-developdev-develop as dev-master的结果相同-控制台显示正确的分支(或更正确的提交be0b349 )下载

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing zendframework/zendframework (2.3.4)
  - Installing zendframework/zendframework (dev-develop be0b349)
    Cloning be0b3496b73a61a255d05e945b75f6fdf0995c31

Writing lock file
Generating autoload files

but after the updating, the code is still like in the master branch. 但是更新之后,代码仍然像master分支中一样。


UPDATE UPDATE

$ cd [project root directory]/vendor/zendframework/zendframework
$ git status
# On branch develop
nothing to commit (working directory clean)

That means, the branch is correct. 这意味着分支是正确的。 And its also up-to-date, since the last commit , git log shows is be0b3496b73a61a255d05e945b75f6fdf0995c31 from 3d of February -- and that is actually the current HEAD revision . 自上次提交以来, git log显示的日期也是最新的,从2月3日起是be0b3496b73a61a255d05e945b75f6fdf0995c31 ,这实际上是当前的HEAD修订版

So, the branch is correct, the revision is correct... Why is the code uot-of-date? 因此,分支正确,修订版本正确...为什么代码是最新的?

The "develop" branch has an alias to be version 2.4. “开发”分支的别名为版本2.4。 You could require "2.4.*@dev" to get it. 您可能需要“ 2.4.*@dev”来获取它。

If this breaks some of your dependencies, you could alias this with a 2.3 version. 如果这破坏了您的某些依赖关系,则可以使用2.3版本作为别名。

"zendframework/zendframework": "dev-develop as 2.3.4.1"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM