错误:在数据源默认值中找不到模型映射的表映射,而设置了$ usetable

时间:2014-05-18 19:07:05

标签: php cakephp

我正在尝试运行cakePHP应用程序。 但是,问题标题中的错误是错误的。它所说的模型就是这个:

<?php
App::uses('AppModel', 'Model');
/**
* Map Model
*
* @property pagina $paginas
*/
class Map extends AppModel {

/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'map';

/**
* Primary key field
*
* @var string
*/
public $primaryKey = 'ID';

/**
* Display field
*
* @var string
*/
public $displayField = 'mapnaam';


//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
* hasMany associations
*
* @var array
*/
public $hasMany = array(
 'paginas' => array(
  'className' => 'pagina',
  'foreignKey' => 'mapID',
  'dependent' => false,
  'conditions' => '',
  'fields' => '',
  'order' => '',
  'limit' => '',
  'offset' => '',
  'exclusive' => '',
  'finderQuery' => '',
  'counterQuery' => ''
 )
);

}

完整的错误跟踪:

Missing Database Table
    Error: Table maps for model map was not found in datasource default.
    Notice: If you want to customize this error message, create app/View/Errors                /missing_table.ctp
    Stack Trace
    •CORE/Cake/Model/Model.php line 3499 → Model->setSource(string) 
    •CORE/Cake/Model/Datasource/DboSource.php line 1063 → Model->getDataSource() 
    •CORE/Cake/Model/Model.php line 2903 → DboSource->read(Pagina, array) 
    •CORE/Cake/Model/Model.php line 2875 → Model->_readDataSource(string, array) 
    •CORE/Cake/Controller/Component/PaginatorComponent.php line 196 → Model->find(string,     array) 
     •APP/Controller/PaginasController.php line 36 → PaginatorComponent->paginate() 
    •[internal function] → PaginasController->index() 
    •CORE/Cake/Controller/Controller.php line 490 →                                 ReflectionMethod->invokeArgs(PaginasController, array) 
    •CORE/Cake/Routing/Dispatcher.php line 185 → Controller->invokeAction(CakeRequest) 
    •CORE/Cake/Routing/Dispatcher.php line 160 → Dispatcher->_invoke(PaginasController,     CakeRequest, CakeResponse) 
    •APP/webroot/index.php line 108 → Dispatcher->dispatch(CakeRequest, CakeResponse) 

这告诉我它仍在使用'maps'作为表名,而SQL表称为'map'。我尝试设置$ usetable变量,但这似乎没有帮助,我没有想法。它应该工作......但事实并非如此。谁能发现我在这里失踪的东西?

0 个答案:

没有答案