加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 数据源默认值中找不到的模型表

发布时间:2020-12-13 22:05:29 所属栏目:PHP教程 来源:网络整理
导读:我正在创建一个cakephp 2.x应用程序.在开发过程中途,我突然发现自己有一个“找不到表”的错误. Missing Database TableError: Table blocked for model Parental was not found in datasource default.Notice: If you want to customize this error message,
我正在创建一个cakephp 2.x应用程序.在开发过程中途,我突然发现自己有一个“找不到表”的错误.

Missing Database Table

Error: Table blocked for model Parental was not found in datasource default.

Notice: If you want to customize this error message,create projectViewErrorsmissing_table

我检查了我的数据库,相关的表实际上就在那里.

接下来,我尝试调试模型.该模型可以访问该表.关于cakephp无法找到数据表的错误仍然存??在.

这是我在调试模型时得到的结果:

projectControllerParentalsController.php (line 5) 
object(Parental) {
    useTable => 'blocked'
    useDbConfig => 'default'
    id => null
    data => array()
    schemaName => null
    table => 'blocked'
    primaryKey => 'id'
    validate => array()
    validationErrors => array()
    validationDomain => null
    name => 'Parental'
    alias => 'Parental'
    tableToModel => array(
        'blocked' => 'Parental'
    )
    cacheQueries => false
    belongsTo => array()
    hasOne => array()
    hasMany => array()
    hasAndBelongsToMany => array()
    actsAs => null
    Behaviors => object(BehaviorCollection) {
        modelName => 'Parental'
        defaultPriority => (int) 10
    }
    whitelist => array()
    cacheSources => true
    findQueryType => null
    recursive => (int) 1
    order => null
    virtualFields => array()
    __backAssociation => array()
    __backInnerAssociation => array()
    __backOriginalAssociation => array()
    __backContainableAssociation => array()
    findMethods => array(
        'all' => true,'first' => true,'count' => true,'neighbors' => true,'list' => true,'threaded' => true
    )
}

我还尝试了以下创建新表而不是模型使用.该模型可以访问新表,但CakePHP仍然无法检测到这些新表.

请指教.

解决方法

我在Google上搜索时发现了这个问题.

我有一个类似的问题.

我一直被提示我没有特定的表,当它显然在那里时我遵循惯例将表命名为复数形式.

我甚至几次清除蛋糕缓存文件无济于事.

然后我将调试模式从0更改为2.突然错误消失了.

然后我将调试模式从2更改回0.错误仍然消失了.

这是一种奇怪的行为.我不确定如何复制它.我正在写这篇文章以防其他人遇到与我相同的问题.

更新:
我已经意识到,对于我经常遇到此问题的一个应用程序,jenkins任务会以某种方式导致tmp / cache / persistent中的某些文件在错误的user:group中出现文件.

我昨天纠正了这个问题.截至目前,这个问题还没有出现.如果问题在10天左右之后没有发生,我将声明问题是因为tmp文件不在正确的权限或用户:组所有权.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读