cakephp sluggable 字段从“name”更改后不会在 indiex 中显示到“标题”
我最近开始使用从面包店出来的可恶的行为。它的默认配置使用“标题”字段来创建 slug。所以我将 mysql 表中的字段名称从“name”更改为“title”,而不是进行配置更改。
我现在遇到的问题是我无法获取这些模型的索引页来显示此表中的任何记录。分页功能起作用,并显示 30 条记录中的 1 条,但索引表中没有任何显示。
因此,我将表字段更改回“名称”,并对配置进行了更改,以便'label=>'name',但这也没有工作。现在就好像它被困在“标题”上一样。
我什至删除了“作为sluggable的行为”,但仍然没有任何变化。
关于为什么更改一个字段名称会阻止显示任何记录的索引,但分页会阻止显示任何记录的任何想法?
始终非常感谢您的帮助。
保罗
I recently started using a sluggable behavior I got out of the bakery. It's default config uses the field 'title' to create the slug. So I changed the field name in my mysql table from 'name' to 'title', instead of making a config change.
The problem I have now is that I can't get the index page for these models to display any records from this table. The paginate function works, and states showing 1 of 30 records, but nothing displays in index table.
So, I changed the table field back to 'name' and made a change to the config so that 'label=>'name', but that also didn't work. It's as though it's stuck on 'title' now.
I even removed the 'acts as sluggable', and still no change.
Any ideas as to why the changing of one field name prevents an index of display any records, but the paginate will?
Always, help is much appreciated.
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 config/core.php 中启用调试并查看它给出的错误。
尝试清除项目中tmp下的缓存目录。只需删除文件并保留目录结构即可。
Enable debugging in your config/core.php and see what error it gives.
Try to clear cache directory under tmp in your project. Just remove files and keep the directory structure.
通常,发生这种情况是因为缓存的表架构与新架构不对应。因此,当
paginate()
调用尝试执行查找时,查询会因无法识别的列名而出错。尝试清除/app/tmp/cache/models
中的文件。并像 Nik 建议的那样启用调试。Usually when that happens it's because the cached table schema doesn't correspond with the new schema. So when the
paginate()
call tries to perform a find, the query errors out due to an unrecognized column name. Try to clear the files in/app/tmp/cache/models
. And enable debugging like Nik suggests.