CakePHP 2.0 - 没有底层数据库表的插件模型

发布于 2025-01-04 17:59:04 字数 470 浏览 4 评论 0原文

我在使用与底层数据库表不关联的模型创建 Cake 2.0 插件时遇到困难。

蛋糕手册说你可以设置变量 public $useTable = false; 但是当我在模型中加载带有此变量的插件时,我仍然收到丢失数据库表的错误消息。

这是我的类定义的开始(我的插件称为 OneTime):

class Ticket extends OneTimeAppModel {

/*
 * This model does not use a database table
 *
 * @var boolean
 */
public $useTable = FALSE;

我在这里做错了什么?

I'm having difficulty in creating a Cake 2.0 plugin with a model that is not associated with an underlying database table.

The Cake Manual says that you can set the variable public $useTable = false; but when I load my plugin with this in my model I still get the missing database table error message.

This is the beginning of my class definition (where my plugin is called OneTime):

class Ticket extends OneTimeAppModel {

/*
 * This model does not use a database table
 *
 * @var boolean
 */
public $useTable = FALSE;

What am I doing wrong here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木森分化 2025-01-11 17:59:04

同时,为了解决方法,我一直在使用:

public $uses = array();

For a workaround in the meanwhile, I've been using this:

public $uses = array();

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文