The Problem:

You changed or modified the database of the Cake PHP site; probably added new columns or tables etc. But these changes do not reflect on the frontend and you do not see the newly added columns or fields when you fetch data from the database through models.

The Cause:

Cake PHP is a heavy frame work. To make things a bit faster it has the ability to cache models, views etc.  So when the site is in production mode i.e. in the configuration file the debug mode is set to 0 Cake PHP uses the cache files of the models to get the database schema rather than fetching it directly from the database each time. Hence, although you have modified the database and as it is not updated in the cache files you don’t get to see the new changes.

The Solution:

You can try either of the below methods to solve the problem.

1. You can change the debug level in the core.php file present under app/Config to 2 and reload the site. Look for the following code inside the file around line no. 35 and change its value.

This will update the cache and you’ll be able to see the new changes. You can restore the debug level to the previous value after you see the new changes taking effect.

 2. Go to the folder app/tmp/cache/models and delete the corresponding model of the table you modified or delete all cached model files there, no problem.

After the above step you should be able to see the new changes when you hit reload, but if the changes are still not showing up, you can go the app/tmp/cache/persistent folder and delete the myapp_cake_core_method_cache file, as sometimes the changes you want to see might be coming from some method calls which have been cached.

Ok, that’s all.