问题
I have been tasked with upgrading a legacy system from Cakephp2.6.2 to Cakephp3.8. Obviously the 2 are drastically different but is there a simple way of getting the old project to work with the new cake version? Or could anyone steer me in the right direction for the best way to do this?
回答1:
There is no generic "best way" that fits all. The best way is the easiest way for your specific application that results in a properly working application, but that's something that you need to determine for yourself.
There's an upgrade tool that can automate some of the repetitive stuff, like changing directory structures, renaming classes, adding namespaces, etc, but in 99.999999% of all cases the result will not be a working application, you'll still have lots of manual migration to do. How much that is, and how complicated it might be, totally depends on your application, it might be rather simple, but it can also be so complicated that rewriting from scratch might be the better choice.
IMHO you should first make yourself familiar with CakePHP 3.x, to the point where you are able to confidently create robust applications. Lots of questions that you may have about upgrading will solve themselves once you are familiar with CakePHP 3.x.
回答2:
You should not directly upgrade from Cakephp 2.x.x to Cakeph 3.x.x, here are reasons,
Code base and directory structure is entirely different and it will not work properly. If you have not good grip on both version trails then you will find yourself in trouble.
Best way in your case, you should upgrade to some higher version of cakephp 2.x not jump to cakephp 3.x. If you want to switch to cakephp 3.x you should rebuild app from scratch.
来源:https://stackoverflow.com/questions/57185556/best-way-to-upgrade-a-cakephp-project-from-cakephp-2-6-2-to-3-8