It is the simple things that sometimes consume most of you time on certain projects. It can be quite irritating trying to figure out why a simple issue like why a field that is clearly in the mysql table does not show up in the results of a simple query. I recently spent about two hours trying to figure what seems at first a simple fix. Here are some steps you can take to remedy the situation.
- First, do a query of the whole table and print an array of the results. For instance print_r($this->Auth->User()); for users table. This will give you an indication if the field is in the table or whether a misspelling is the culprit
- It could also be a cache issue. Delete all the cache files in log/cache/models
- If this does not work, alternate you debug number, from 0 to 2, vice versa
- The last option is to prevent cache altogether. Open your /app/config/core.php file and write
Configure::write('Cache.disable', true);