2

I have a cake application which has a table named realestate_properties in its database. I added two columns i.e. latitude and longitude to this table.

On the HTML form there are already many fields, I just added the two fields named latitude and longitude. Now when I am submitting the data, it's only adding the other fields which are already available. There is no effect on new fields.

Please suggest a good solution. Do I need to define the new column names anywhere in addition to the HTML form and database table?

CakePHP version is 2.4.1

Inigo Flores
  • 4,461
  • 1
  • 15
  • 36

2 Answers2

3

A possible cause for the behavior you mention is CakePHP failing to refresh the cached schema of your models stored in

/app/tmp/cache/models

This may happen if you've made changes to the database but haven't switched debugging on.

Try turning debug to 2 by editing /app/Config/core.php and setting

Configure::write('debug', 2);

Next time you access your action, CakePHP should refresh the cache.

If this doesn't solve your problem, try deleting the contents of

/app/tmp/cache/models
/app/tmp/cache/persistent

But only the contents, don't deleted the folder structure.

Inigo Flores
  • 4,461
  • 1
  • 15
  • 36
2

Yes cache has to be cleared, All files under model folder and 'myapp_cake_core_method_cache' file under persistent folder.

tmp/cache/models/*
tmp/cache/persistent/myapp_cake_core_method_cache
Captain Sparrow
  • 1,114
  • 17
  • 26