Step by step migration from Zend Framework 1 to 2

前端 未结 4 1974
无人共我
无人共我 2020-12-07 16:40

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 adopt

4条回答
  •  轮回少年
    2020-12-07 17:43

    We have been migrating a large application from Zend Framework 1 to Zend Framework 2 over the past year. We started out with simple things like namespacing, and slowly worked our way into the various library components. Ultimately, we ended up editing Zend_Layout to work with Zend\Filter, Zend_Form to work with Zend\Filter and Zend\Json, Zend_Navigation to work with Zend\Permissions\Acl, etc. This helped us to eliminate almost all ZF1 components with the exception of the ZF1 application structure which includes four classes Zend_Application, Zend_Config, Zend_Controller, and Zend_Layout. The final piece of the puzzle is the implementation of Zend\Mvc\Application and Zend\View, the remainder is ZF2-ready.

    Most recently, we created a proxy of sorts to hook into Zend\Mvc\Application and ZF2 modules from ZF1. This has been extremely helpful. I detailed the steps over at http://webjawns.com/2013/11/migrating-to-zf2-integrating-composer-and-doctrineormmodule/.

    In summary...

    • Convert prefixes to namespaces (Model_ to Model\, Application_Controller to Application\Controller, etc.)
    • Replace non-MVC components with ZF2 counterparts including autoloader
    • Create ZF2 application structure and hooks to begin utilizing ZF2 modules
    • Move controllers and views (still working on a plan for this one)

提交回复
热议问题