Find all with contain in cakePhp 2.5.6

The ORM for v3 is definitely a huge improvement over what v2 offers. It wouldn’t directly fix this issue, but I expect it would make it easier to solve.

If you’re going to upgrade, you should upgrade to the latest, v3.9 if not 4.0. However, while there are some automated tools for converting from v2 to v3 (and from v3 to v4), they are mainly about rearranging file structure, adding namespace declarations, that sort of thing. They can’t really do anything with your custom coding, business logic, etc. So, partly automatic, but not easy.

To make it work, cakephp 4.0 needs php 7.x or is it possible to make it work in php 5.x?
And what tool do you recommend me to use to migrate to v3.9 and then to v4.0?

Cake4 requires PHP 7.2 or higher.

Here are the tools for converting v2 to v3, guides for migrating through the various minor versions (tools not required for those, just things to be aware of, as they will affect your code), and the v3 to v4 upgrade guide, which includes details on that tool.

How can I do that in windows?

Can you you do what in Windows?

The steps to upgrade from v2.x to v3.x, git clone, etc.

Not to be rude, but if you don’t know how to run git clone or command line tools, I feel like converting Cake 2.x to 3.x or 4.x is likely going to be well beyond.

I understand, I have to install git for windows and run it there

I am having problems to upgrade from v2.x to v3.x, it gives me this error when I want to execute the upgrade in dry run:


For some reason the upgrade that I cloned from github is for v4.0 from v3.x, how can I get the upgrade from v2.x to v3.x?

I did include links for both the 2->3 and 3->4 migration. You’d need to run them in that order.

Yes, I did that, but when I executed git clone https://github.com/cakephp/upgrade.git from the v2-v3 tutorial it cloned me the v3-v4 upgrader because when I executed bin/cake upgrade --help it showed me only the subcommands for migrating to v4, it didn’t show me all the subcommands that correspond to v2-v3, and now I cloned the github repository and it gives me this error:


Do you have access to that repository or know how to get the whole package to do the upgrade?

Anything about autoloading is generally a composer issue. Did you run composer install after cloning the repo, to get all the dependencies in place?

No, I thought that running one time was sufficient, I will do that and try the upgrade, thank you.

When I run the command bin/cake upgrade rector --rules phpunit80 D:/wamp64/www/estadoatulado/app/tests it gives me this error:
No autoload file could be found. Use the --autoload flag to provide a path.
How can I solve this issue?

Is there a vendor path? vendor/autoload.php file? vendor/composer path? Several autoload files in there?

No, what do I have to do to create that folder?

composer install, I thought that was clear.

In the upgrader are those folders and files, when I run the bin/cake upgrade rector --rules phpunit80 D:/wamp64/www/estadoatulado/app/tests I have to add --autoload vendor/autoload.php?

Cake and its utilities rely heavily on the autoload functionality provided by composer. Whatever folder you’re running bin/cake from is going to need to have all of that, and it should find it automatically. If it’s not in the right place, that will break it. You said those folders weren’t there, now you say they are? Again, sorry, but nothing about this line of questioning is inspiring confidence that you’re going to be able to complete the project; these should be the easy parts.

I run the composer install, I thought that the autoload.php should be in path/to/app and not in the upgrade, but in the upgrade folder is the folder vendor with the file autoload.php in it, for some reason the upgrader doesn’t detect the autoload automatically