如何将旧项目迁移到 Zend Tool?
我有一个大约在 Zend Framework 1.7 上开发的项目,我想将其迁移到 Zend Tool 和 ZF 1.9.4pl1。我希望获得的主要好处是能够使用模型、表单等的自动加载。换句话说,我想消除所有这些小方法:
protected function _getSurveyForm() { require_once APPLICATION_PATH 。 '/forms/Survey.php'; $form = new Form_Survey(); $form->setAction($this->_helper->url('调查')); 返回$表单; 。
我的策略是这样的 首先,
zf create project foo
zf create controller bar
zf create controller arf
etc.
直到我设法重新创建所有控制器、视图等的结构。其次,我要复制现有的控制器、视图、模型等,覆盖 zf 工具创建的存根,并确保所有我的类名和文件名排列在一起。
这是最好的方法吗?我是否困惑地认为我将能够消除上面的 _getSurveyForm() 这样的小加载器方法?
I've got a project developed circa Zend Framework 1.7 that I'd like to migrate to Zend Tool and ZF 1.9.4pl1. The main benefit I hope to gain is to be able to use automatic loading of Models, Forms, etc. In other words, I want to eliminate all of these little methods:
protected function _getSurveyForm() {
require_once APPLICATION_PATH . '/forms/Survey.php';
$form = new Form_Survey();
$form->setAction($this->_helper->url('survey'));
return $form;
}
My strategy was going to be this. First,
zf create project foo
zf create controller bar
zf create controller arf
etc.
until I managed to recreate the structure for all the controllers, views, etc. Second, I was going to copy in my existing controllers, views, models, etc., overwriting the stubs created by zf tool, and making sure that all my class names and file names lined up.
Is this the best way to go? Am I confused thinking that I'm going to be able to eliminate the little loader methods like _getSurveyForm() above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那么您可以直接使用新的自动加载器,只需向它注册您的名称空间,以便它可以自动加载您的类,您不需要创建新的项目布局。
Well you can use directly the new Autoloader and just register your namespaces with it so it can autoload your classes, you don't need to create a new project layout.