从Symfony 1.4到Symfony 2.0需要付出努力

时间:2021-03-25 07:27:14

I have a website written in Symfony 1.4. It was my first symfony website and the learning curve was a bit steep for me. It is a fairly complicated website, and I don't want to 'fix it' if its not broken.

我有一个用Symfony 1.4编写的网站。这是我的第一个symfony网站,学习曲线对我来说有点陡峭。这是一个相当复杂的网站,如果没有破坏,我不想“修复它”。

Having said that, since sf 1.4 is now legacy code, I will eventually want to port the site to sf 2.0. as a matter of fact, I am relaunching the site early next year, and I want to know if I might just as well bite the bullet and "port" the site from 1.4 to 2.0 in one go.

话虽如此,由于sf 1.4现在是遗留代码,我最终希望将网站移植到sf 2.0。事实上,我将在明年初重新启动该网站,我想知道我是否也可以咬紧牙关并将该网站从一站式“移植”到1.4到2.0。

So, I need to know answers to the following:

所以,我需要知道以下内容的答案:

  1. How much of what I already know from 1.4 is applicable to 2.0?
  2. 我从1.4中已经知道了多少适用于2.0?
  3. Are there any jobeet or askeet type tutorials out there that show how to build an entire app using the sf framework?
  4. 是否有任何jobeet或askeet类型的教程,展示如何使用sf框架构建整个应用程序?
  5. Am I mad, thinking of porting a big website in effectively just over a month (working only part time?) - i.e. is the "big bang" approach the wisest/only approach?
  6. 我疯了,想在一个多月内有效地移植一个大型网站(只工作一段时间?) - 即“大爆炸”方法是最明智/唯一的方法吗?

3 个解决方案

#1


22  

I don't want to 'fix it' if its not broken.

如果没有破坏,我不想“修理它”。

Don't!

别!

Am I mad, thinking of porting a big website in effectively just over a month (working only part time?)

我疯了,想在一个多月内有效地移植一个大网站(只兼职工作?)

Yes, you are! :)

是的,你是! :)

Symfony2 and symfony 1.4 are wildy different. We're not talking about some updates to symfony 1.x, we're talking about a brand new framework from the ground up. It's really like asking "How hard would it be to switch from symfony 1.4 to Zend Framework/Kohana/Yii/CakePHP/etc...".

Symfony2和symfony 1.4是不同的。我们不是在讨论symfony 1.x的一些更新,我们从头开始谈论一个全新的框架。这就像问“从symfony 1.4切换到Zend Framework / Kohana / Yii / CakePHP /等等有多难”。

I moved a project (in its very early stages) from symfony 1.4 to Symfony2 and found that except for my familiarity of the MVC pattern, not much (if anything) else was transferable from symfony 1.4 to 2. We're talking about new directory structures, new classes, Doctrine 2, the (awesome) Dependency Injection Container, and more.

我将一个项目(在很早的阶段)从symfony 1.4移动到Symfony2,发现除了我对MVC模式的熟悉之外,没有太多(如果有的话)其他内容可以从symfony 1.4转移到2.我们在谈论新目录结构,新类,Doctrine 2,(真棒)依赖注入容器等。

Symfony2 has its own learning curve, and even though the architecture is better than symfony 1.4, you will be spending a good amount of time going through trial and error and reading the docs.

Symfony2有自己的学习曲线,即使体系结构优于symfony 1.4,你也会花费大量的时间进行反复试验和阅读文档。

Symfony2 is great, and I recommend learning it, but do so at a manageable pace. There's a number of tutorials online - check them out and go through the official Symfony2 docs and cookbook when you're ready.

Symfony2很棒,我建议学习它,但是要以可控的速度这样做。有许多在线教程 - 检查出来并在准备好后通过官方的Symfony2文档和食谱。

#2


9  

@Arms response is fantastic. Even though the answer has been accepted, I thought I'd add a few of my thoughts to the discussion.

@Arms的反应太棒了。尽管答案已被接受,但我想我会在讨论中加入一些想法。

I started work on the development of a personal project about a year ago. I chose symfony 1.4 because Symfony 2 wasn't in a stable phase and I was already an expert in symfony 1.4.

大约一年前,我开始研究个人项目的开发。我之所以选择symfony 1.4是因为Symfony 2没有处于稳定阶段,而且我已经是symfony 1.4的专家。

After working for a year in my spare time (I work a full time job) and this is what I have (and it's still growing, about 60% done):

在我的业余时间工作了一年(我从事全职工作)这就是我所拥有的(而且它仍在增长,大约60%完成):

  1. 70,000 lines of php code (Doctrine queries, actions, templates)
  2. 70,000行php代码(Doctrine查询,操作,模板)
  3. 10,000 lines of custom javascript code
  4. 10,000行自定义JavaScript代码
  5. 3000 lines of YAML
  6. 3000线YAML

My schema.yml file for example is 872 lines which consists of 62 table definitions.

例如,我的s​​chema.yml文件是872行,由62个表定义组成。

My routing file is 500 lines.

我的路由文件是500行。

Moving a schema definition of that size over to Doctrine2 entities would be a mammoth task. It would take me a very long time. If I were to rewrite what I've done now to Symfony2. It would probably take me a year.

将该大小的模式定义移动到Doctrine2实体将是一项庞大的任务。这需要我很长时间。如果我要重写我现在对Symfony2所做的事情。这可能需要一年的时间。

Transitioning over my current authentication system (sfDoctrineGuard) over to a symfony2 implementation would also big a big task. All my command line tasks, doctrine queries, templates would have to change.

将我当前的身份验证系统(sfDoctrineGuard)转换为symfony2实现也是一件大事。我的所有命令行任务,学说查询,模板都必须改变。

In fact, everything would have to change. The only thing that would stay the same is the database username and password.

事实上,一切都必须改变。唯一保持不变的是数据库用户名和密码。

If I had the resources and time I would consider moving over to Symfony2. One of the biggest advantages I'd get is the performance gain and the better architecture that Symfony2 offers.

如果我有资源和时间,我会考虑转移到Symfony2。我得到的最大优势之一是Symfony2提供的性能提升和更好的架构。

I work with symfony2 at the moment in my full time job and I like it a lot but there are still certain things which I'm not sure how to achieve in symfony2 which I know how to do in symfony 1.

我目前在我的全职工作中使用symfony2并且我非常喜欢但是仍然有一些我不确定如何在symfony2中实现的事情,我知道如何在symfony 1中做。

For the moment, moving over to Symfony2 for my project is a definite NO. I'd like to but as I have said I don't have the time or resources to and plus the application is working very well indeed. Everything has been re-factured and I've been careful with the development to make sure I'm not repeating code.

目前,为我的项目转移到Symfony2是一个肯定的NO。我想,但正如我所说,我没有时间或资源,加上应用程序确实工作得非常好。一切都已经重新制定,我一直小心开发,以确保我不重复代码。

Also, maintenance of Symfony 1.4 is due to end in about a year.

此外,Symfony 1.4的维护将在一年左右结束。

If it works well then don't change it. Only change it when you have the resources available and you're knowledgeable in Symfony2 to make sure you don't give yourself any headaches.

如果它运作良好,那么不要改变它。只有拥有可用资源并且您在Symfony2中了解情况才能更改它,以确保您不会给自己带来任何麻烦。

Best of luck.

祝你好运。

#3


4  

Symfony 1.4 is not legacy code. It is still fully supported by the Symfony team and has a 3 year support promise which ends at the end of November 2012.

Symfony 1.4不是遗留代码。它仍然得到Symfony团队的全力支持,并有一份为期3年的支持承诺,将于2012年11月底结束。

#1


22  

I don't want to 'fix it' if its not broken.

如果没有破坏,我不想“修理它”。

Don't!

别!

Am I mad, thinking of porting a big website in effectively just over a month (working only part time?)

我疯了,想在一个多月内有效地移植一个大网站(只兼职工作?)

Yes, you are! :)

是的,你是! :)

Symfony2 and symfony 1.4 are wildy different. We're not talking about some updates to symfony 1.x, we're talking about a brand new framework from the ground up. It's really like asking "How hard would it be to switch from symfony 1.4 to Zend Framework/Kohana/Yii/CakePHP/etc...".

Symfony2和symfony 1.4是不同的。我们不是在讨论symfony 1.x的一些更新,我们从头开始谈论一个全新的框架。这就像问“从symfony 1.4切换到Zend Framework / Kohana / Yii / CakePHP /等等有多难”。

I moved a project (in its very early stages) from symfony 1.4 to Symfony2 and found that except for my familiarity of the MVC pattern, not much (if anything) else was transferable from symfony 1.4 to 2. We're talking about new directory structures, new classes, Doctrine 2, the (awesome) Dependency Injection Container, and more.

我将一个项目(在很早的阶段)从symfony 1.4移动到Symfony2,发现除了我对MVC模式的熟悉之外,没有太多(如果有的话)其他内容可以从symfony 1.4转移到2.我们在谈论新目录结构,新类,Doctrine 2,(真棒)依赖注入容器等。

Symfony2 has its own learning curve, and even though the architecture is better than symfony 1.4, you will be spending a good amount of time going through trial and error and reading the docs.

Symfony2有自己的学习曲线,即使体系结构优于symfony 1.4,你也会花费大量的时间进行反复试验和阅读文档。

Symfony2 is great, and I recommend learning it, but do so at a manageable pace. There's a number of tutorials online - check them out and go through the official Symfony2 docs and cookbook when you're ready.

Symfony2很棒,我建议学习它,但是要以可控的速度这样做。有许多在线教程 - 检查出来并在准备好后通过官方的Symfony2文档和食谱。

#2


9  

@Arms response is fantastic. Even though the answer has been accepted, I thought I'd add a few of my thoughts to the discussion.

@Arms的反应太棒了。尽管答案已被接受,但我想我会在讨论中加入一些想法。

I started work on the development of a personal project about a year ago. I chose symfony 1.4 because Symfony 2 wasn't in a stable phase and I was already an expert in symfony 1.4.

大约一年前,我开始研究个人项目的开发。我之所以选择symfony 1.4是因为Symfony 2没有处于稳定阶段,而且我已经是symfony 1.4的专家。

After working for a year in my spare time (I work a full time job) and this is what I have (and it's still growing, about 60% done):

在我的业余时间工作了一年(我从事全职工作)这就是我所拥有的(而且它仍在增长,大约60%完成):

  1. 70,000 lines of php code (Doctrine queries, actions, templates)
  2. 70,000行php代码(Doctrine查询,操作,模板)
  3. 10,000 lines of custom javascript code
  4. 10,000行自定义JavaScript代码
  5. 3000 lines of YAML
  6. 3000线YAML

My schema.yml file for example is 872 lines which consists of 62 table definitions.

例如,我的s​​chema.yml文件是872行,由62个表定义组成。

My routing file is 500 lines.

我的路由文件是500行。

Moving a schema definition of that size over to Doctrine2 entities would be a mammoth task. It would take me a very long time. If I were to rewrite what I've done now to Symfony2. It would probably take me a year.

将该大小的模式定义移动到Doctrine2实体将是一项庞大的任务。这需要我很长时间。如果我要重写我现在对Symfony2所做的事情。这可能需要一年的时间。

Transitioning over my current authentication system (sfDoctrineGuard) over to a symfony2 implementation would also big a big task. All my command line tasks, doctrine queries, templates would have to change.

将我当前的身份验证系统(sfDoctrineGuard)转换为symfony2实现也是一件大事。我的所有命令行任务,学说查询,模板都必须改变。

In fact, everything would have to change. The only thing that would stay the same is the database username and password.

事实上,一切都必须改变。唯一保持不变的是数据库用户名和密码。

If I had the resources and time I would consider moving over to Symfony2. One of the biggest advantages I'd get is the performance gain and the better architecture that Symfony2 offers.

如果我有资源和时间,我会考虑转移到Symfony2。我得到的最大优势之一是Symfony2提供的性能提升和更好的架构。

I work with symfony2 at the moment in my full time job and I like it a lot but there are still certain things which I'm not sure how to achieve in symfony2 which I know how to do in symfony 1.

我目前在我的全职工作中使用symfony2并且我非常喜欢但是仍然有一些我不确定如何在symfony2中实现的事情,我知道如何在symfony 1中做。

For the moment, moving over to Symfony2 for my project is a definite NO. I'd like to but as I have said I don't have the time or resources to and plus the application is working very well indeed. Everything has been re-factured and I've been careful with the development to make sure I'm not repeating code.

目前,为我的项目转移到Symfony2是一个肯定的NO。我想,但正如我所说,我没有时间或资源,加上应用程序确实工作得非常好。一切都已经重新制定,我一直小心开发,以确保我不重复代码。

Also, maintenance of Symfony 1.4 is due to end in about a year.

此外,Symfony 1.4的维护将在一年左右结束。

If it works well then don't change it. Only change it when you have the resources available and you're knowledgeable in Symfony2 to make sure you don't give yourself any headaches.

如果它运作良好,那么不要改变它。只有拥有可用资源并且您在Symfony2中了解情况才能更改它,以确保您不会给自己带来任何麻烦。

Best of luck.

祝你好运。

#3


4  

Symfony 1.4 is not legacy code. It is still fully supported by the Symfony team and has a 3 year support promise which ends at the end of November 2012.

Symfony 1.4不是遗留代码。它仍然得到Symfony团队的全力支持,并有一份为期3年的支持承诺,将于2012年11月底结束。