How to you extend a cakePHP project so it can use a new field in the database?
I just given a CakePHP Project that I am trying to extend the model to include a new field
In cakephp 3 you should also check your entity file for that model, and make sure that the field is under the $_accesible property.
Example:
protected $_accessible = [
'name' => true,
'topic' => true,
'new_field' => true
];
Try to clear all models under cache directory.
app/tmp/cache/models
You need to inform cakephp that you have new fields in your db. Why you need to do so is coz cakephp scans the db only once and generates the schemas. Once refers to first time it's run. You can find the schemas in app\tmp\cache\models
.
So if you clear the files in the above folder cake will re generate the schema. Now there is a exception to it, if you are in development/debug mode cakephp scans it everytime.
Actually, any changes to database, anytime , you should change debug mode to 2 in app/config/core.php
if it is zero. Otherwise it will take values from cache.