我正在创建一个 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 project\View\Errors\missing_table
我检查了我的数据库,并且关联的表实际上在那里。
接下来,我尝试调试模型。该模型可以访问该表。关于 cakephp 找不到数据表的错误仍然存在。
这是我调试模型时得到的:
\project\Controller\ParentalsController.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 仍然无法检测到这些新表。
请指教。