Magento 自定义模型不允许更改数据库表 [英] Magento custom model won't allow DB table changes

查看:20
本文介绍了Magento 自定义模型不允许更改数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建的自定义 Magento 模块遇到问题.

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

简而言之,我为前端的客户上传创建了一个简单的模块.我创建了一个新表,其中包含一些通用字段,如project_id"、title"等.这一切都很好……我可以设置模型变量并使用 model->save(); 将它们保存到我的表中.

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!

推荐答案

清除缓存.Magento 用于读取数据库列的 Zend 类将缓存该信息(这样就没有必要为每个模型加载/保存执行 DESCRIBE).清除缓存,Magento 应该会看到新列,并且值将开始持久保存到数据库中.

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.

这篇关于Magento 自定义模型不允许更改数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆