I need to upgrade cakephp 2.7.5 to cakephp 3.5


#1

I need to upgrade cakephp 2.7.5 to cakephp 3.5. Please let me know the steps or guide from where I can follow the steps.


#2

As Cake 3 broke backward compatibility there is no easy way. It can be relatively easy or really hard depending on your codebase.


Migration from 2.4.2 to the latest version
#3

Thanks! can you please help me out. what I have to take care while migrating?


Migration from CakePHP2.x to CakePHP 3.x
#4

Well there are a lot of things and they are different for each and every projects. If you are using fat models it is easier, if not it is harder.
Just use the upgrade tool, and than start to debug your application. And prepare for a lot of rewrite.

I am in the process upgradeing one of my big applications. A lot of rewrite but the code is significantly smaller and better.


#5

Yes true, Its also time consuming. I have taken around 2 days just to display the login screen. As I am new in cakephp.
But can you please help me in models? How can we make or call models in cakephp 3.6. I have tried alot on internet but not getting a proper content.
I have already done upgrade tool, resolving the errors now.
I am facing below error:
Error: Class ‘App\Model’ not found
File C:\xampp\htdocs\cakphp\src\Model\AppModel.php
Line: 41
Any suggestions?
Thanks!


#6

As in CakePHP 3 Models divided into entities and tables, there is no model class. So you can just delete your AppModel.php

If you have some custom functionality there you should move it to table or entity classes.


#7

Thanks! If possible can you please share any link for reference?


#8

Reference for what? The whole process? I do not think there is something like this as it is different foor each projects. You can just follow the error messages first, try to fix them, and you can start refactor your codebase.


#9

ok. Thanks! I will surely follow this process and will let you know if I face any hurdle.


#10

Check the migration guides in the book. They explain what was changed.


#11

Hi,
Does anyone have any clue related to below error.
Fatal error : Cannot make non static method Cake\ORM\Table::get() static in class App\Model\Table\UsersTable in C:\xampp722\htdocs\cakphp36\src\Model\Table\UsersTable.php on line 9

Thanks

Regards
Anuj


#12

Sure.

Just let us know what is in C:\xampp722\htdocs\cakphp36\src\Model\Table\UsersTable.php on line 9


#13

Issue resolved… Thanks!


#14

You can share your soultion, it can help others also


#15

ok! sure…
From now onwards, I will also share the solution.

Right now I am working on authentication process, changing it from 2.7.5 to 3.6.

I have change from auth login to this->Auth->identify() but it is giving boolean (false).

getting below output on debugging:

\src\Controller\UsersController.php (line 36 )

[ ‘User’ => [ ‘username’ => ‘leon’, ‘password’ => ‘anuj’ ], ‘btnSubmit’ => ‘’ ]

\src\Controller\UsersController.php (line 37 )

false

Any suggestions?

Regards
Anuj


#16

Please open a new thread for this and share your UsersController code for handling login


#17

ok.

Sure.

Thanks…!!