Magento custom model won't allow DB table changes

爷,独闯天下 提交于 2019-11-30 16:50:22

问题


I've run into an issue with a custom Magento module I've created.

In short, I created a simple module for customer uploads on the front-end. I created a new table with some generic fields like 'project_id', 'title', etc. This is all fine...I can set model variables and save them to my table using model->save();.

Just now I have the need to add a new field or change an old field's name around. For a reason that I can't understand new fields and changed fields will not get stored to via model->save(); even though I can see from my debugger that new and changed variables in my model are being set correctly. I'm hoping someone has run into this already and can shed some light on this extremely frustrating issue. My project is at a stand-still until help arrives!


回答1:


Clear you cache. The Zend classes Magento uses to read database columns will cache that information (such that it's not necessary to do a DESCRIBE for each model load/save). Clear out your cache and Magento should see the new columns, and values will start persisting to the database.




回答2:


Disabling cache in Magento admin panel seems not to be enough. You should delete the contents of /var/cache manually.




回答3:


Run rm -rf var/cache/* from the console, as you wont be able to get through to the admin Cache Management screen



来源:https://stackoverflow.com/questions/8751694/magento-custom-model-wont-allow-db-table-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!