cakephp new field not saving

前端 未结 10 617
渐次进展
渐次进展 2021-02-02 14:43

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

相关标签:
10条回答
  • 2021-02-02 14:56

    clear cache at /app/tmp/cache

    if raising debug level to 2 or 3 is not working.

    check if, on using debug($Model), shows your new field under schema attribute of model.

    0 讨论(0)
  • 2021-02-02 15:03

    In CakePHP application, whenever you add a new field or modify the structure in database, you should delete all files inside YourApplication/app/tmp/cache/models folder.

    0 讨论(0)
  • 2021-02-02 15:07

    Whenever you do any database change follow the following steps :

    1. Clear files under \app\tmp\cache\models
    2. If you are using any cache engines like memcache, restart the cache service.
    3. Set the debug to 2 in core.php
    0 讨论(0)
  • 2021-02-02 15:10

    Whenever you make any changes to your database, please make sure that your app/config/core.php file debug value is 2. Configure::write('debug', 2);

    If it is 0 database changes will not be detected.

    0 讨论(0)
  • 2021-02-02 15:10

    You can also delete cache file if your database changes are not working.

    path of your application\app\tmp\cache\models

    0 讨论(0)
  • 2021-02-02 15:12

    Quite a bit later, but I was looking for a way to do this today in Cake 3.x. Easiest way, imo:

    bin/cake orm_cache build
    

    which will rebuild the cache w/ the current db structure.

    Or to just clear w/o rebuild:

    bin/cake orm_cache clear
    

    http://book.cakephp.org/3.0/en/console-and-shells/orm-cache.html

    0 讨论(0)
提交回复
热议问题