从Zend Framework 1逐步迁移到2 [英] Step by step migration from Zend Framework 1 to 2

查看:70
本文介绍了从Zend Framework 1逐步迁移到2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将应用程序从Zend Framework 1.12.0迁移到版本2.似乎有

I have to migrate an application from Zend Framework 1.12.0 to version 2. There seem to be no migration guides yet. I have already studied ZF2 coding conventions and I adopted dependency injection (Zend\Di) and PHP 5.3 namespaces. My goal is to refactor my ZF1 application into a ZF2 module.

问题:是否可以在每个步骤之后逐步处理至少部分工作的应用程序,并且避免大量重构步骤?如果是,该怎么办?

Question: Is it possible to proceed step-by-step with an at least partly working application after every step and avoid huge refactoring steps? If yes, what are the steps?

这是我逐步进行迁移的想法,但我不知道在每一步之后是否最终都可以使用可运行的应用程序

Here's my idea of such a step-by-step migration, but I don't know if I end up with a working application after every step:

  1. 首先设置 ZF2骨架应用
  2. 设置新模块(MyApp)并重新组织将我的ZF1应用程序的内容放入MyApp模块文件夹结构中.然后设置非常基本的配置并进行引导,并通过从ZF2 AbstractActionController对其进行扩展来迁移IndexController.模型(Zend_Db)和视图(Zend_View)将在以后迁移.这里的目标是要有一个工作正常的IndexController :: indexAction,它没有太多的依赖关系.
  3. 设置更多配置和引导程序(路由,翻译,语言环境,缓存,Db,Acl,ViewHelpers等).我想先设置这些组件的ZF1版本,然后一个接一个地迁移它们.
  4. 使用Zend \ Di或通过 phing 脚本与新的目录结构一起使用来设置自动部署.
  5. 将视图(包括助手)和表单迁移到ZF2.
  6. 迁移模型(从Zend_Db迁移到ZF2 Zend \ Db或Doctrine).
  7. 一个接一个地迁移其他ZF1组件(翻译,语言环境,缓存,Acl等).
  8. 重构康复和漫长的假期.
  1. Start by setting up the ZF2 Skeleton Application
  2. Set up a new module (MyApp) and reorganize the contents of my ZF1 application into the MyApp module folder structure. Then set up very basic configuration and bootstrapping and migrate the IndexController by extending it from the ZF2 AbstractActionController. The models (Zend_Db) and views (Zend_View) will be migrated later. The goal here is to have a working IndexController::indexAction which doesn't have many dependencies.
  3. Set up more configuration and bootstrapping (Routing, Translate, Locale, Cache, Db, Acl, ViewHelpers, ...). I'd like to set up the ZF1 versions of these components first and migrate them later one by one.
  4. Migrate the other controllers and set up dependency injection into the controllers either with Zend\Di or by using the ServiceManager.
  5. Set up automatic deployment by making the old phing scripts work with the new directory structure.
  6. Migrate the views (including helpers) and forms to ZF2.
  7. Migrate the models (from Zend_Db either to ZF2 Zend\Db or to Doctrine).
  8. Migrate other ZF1 components one by one (Translate, Locale, Cache, Acl, ...).
  9. Refactoring rehab and long holiday.

但是,仅当某些ZF2组件与ZF1组件一起工作时,我才会在每个步骤之后都有一个workin应用程序.我不知道是不是可以在ZF2控制器上使用ZF1视图(和视图助手).

However, I will have a workin application after every step only if certain ZF2 components work together with ZF1 components. I have no idea if it's e.g. possible to use ZF1 views (and view helpers) with ZF2 controllers.

推荐答案

从Zend Framework 1迁移

本指南旨在提供从Zend Framework 1迁移到Zend Framework 2的工具和策略.没有适用于每个项目的单一解决方案,也没有自动化该过程的工具.

This guide is intended to provide tools and strategies for migrating from Zend Framework 1 to Zend Framework 2. There is no single solution that will work for every project, nor any tools to automate the process.

在本指南中,我们将介绍以下内容:

In this guide, we will cover the following:

  1. 用于命名代码间隔的工具.
  2. 在Zend Framework 1应用程序中使用Zend Framework 2的工具.
  3. 并行运行Zend Framework 2和Zend Framework 1的策略.
  4. 使代码更易于迁移的策略,主要集中在域逻辑和MVC层的清晰分离上.
  5. 迁移MVC层的策略.
  6. 迁移域层的策略.

http://framework.zend.com/manual/2.1/zh/migration/overview.html

这篇关于从Zend Framework 1逐步迁移到2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆