所以我的应用程序在一个地方以开发模式运行,在其实时服务器上以生产模式运行。 我刚刚进行了一些更改,并且调用Model::read()
找不到已在生产数据库(MySQL)中存在了一两个星期的字段。 以下是代码,逐字:
$this->Order->id = $id;
$created = $this->Order->field('created');
$this->Order->contain(array('User', 'OrderStatusChange', 'Cart' => array('CartItem' => array('conditions' => array('deleted_date' => null, 'created <=' => $created)))));
$this->request->data = $order = $this->Order->read();
开发环境中的相同代码返回所有字段。 生产中缺少 new(ish) 字段。 我已经删除了/app/tmp/cache/models中的每个文件,但它没有解决问题。 生产站点有Configure::write('debug', 0)
,开发站点设置为2。
有什么想法吗?
谢谢
由于您已经清除了缓存,但问题仍然存在。所以,我将在这里指出一件事:
$this->Order->contain(...)
在这里您使用contain()
,对于contain()
,需要将Containable
行为附加到模型。您的代码没有阐明您是否附加了它。如果没有,那么我建议您附上以下内容:
.....
$this->Order->Behaviors->attach('Containable'); // attach Containable behavior
$this->Order->contain(...);
......