2009-06-16 39 views
4

我已经添加了一个新的列到我的表已经有的属性(id,form_id(外键),类型,标签,大小,序列号,instr) 其中instr是我添加的新列。为什么CakePHP的查询结果中没有显示新的表列?

我的应用程序在CakePHP和MySQL中。

我已经使用下面的代码插入到表中的属性但是instr单独没有插入。

function saveFieldname($data)//from untitledfieldname 
{ 
    $this->data['Attribute']['form_id'] = $this->find( 'all', array(
                 'fields' => array('Form.id'), 
                 'order' => 'Form.id DESC' 
                )); 

    $this->data['Attribute']['form_id'] = $this->data['Attribute']['form_id'][0]['Form']['id']; 

    $this->data['Attribute']['label'] = 'Label'; 
    $this->data['Attribute']['size'] ='50'; 
    $this->data['Attribute']['instr'] ='Fill'; 

    $this->data['Attribute']['type'] = $data['Attribute']['type']; 
    $this->data['Attribute']['sequence_no'] = $data['Attribute']['sequence_no']; 

    $this->Attribute->save($this->data); 
} 

请建议我..

回答

7

餐桌的结构中的信息可能是缓存。删除“app/tmp/cache/models”的内容并再次尝试。

+0

Ya现在我已经删除了/ cache/Models文件夹中的文件,现在完成了。 谢谢你。 – useranon 2009-06-16 09:36:29

+0

非常感谢,我在这张 – 2009-08-24 11:41:42

0

请注意,在开发过程中,app/config/core.php中的调试级别通常设置为> 1.这意味着您不应该在开发中遇到问题,因为Cake不会缓存。但是,在生产中,core.php中的debug设置为0,从而导致Cake开始缓存。为了补充说明,我已经将应用程序/ tmp/cache/models中的缓存文件移除为我在生产CakePHP应用程序中指定的dhofstet,并且查找查询仍然没有抓取我的新列。

-

除了清除模型缓存文件,我将在我的生产现场调试级别为2,没有刷新页面然后将其设置回0,并得到它再次合作。我知道这是一种丑陋的方法,但是在没有其他方法可行的情况下,它为我解决了这个问题。

相关问题