Modelで
var $useTable = false;
という設定をして、
$this->Model->create($this->data);
をすると、
Warning (512): (Model::getColumnType) Unable to locate model field data. If you are using a model without a database table, try implementing schema() [CORE/cake/libs/model/model.php, line 959] Code | Context $column = "how_know" $cols = array() $cols = $this->schema(); if (empty($cols)) { trigger_error(__('(Model::getColumnType) Unable to locate model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING); Model::getColumnType() - CORE/cake/libs/model/model.php, line 959 Model::deconstruct() - CORE/cake/libs/model/model.php, line 857 Model::set() - CORE/cake/libs/model/model.php, line 839 Model::create() - CORE/cake/libs/model/model.php, line 1014 PartnersController::regist() - APP/controllers/partners_controller.php, line 20 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 265 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 237 [main] - APP/webroot/index.php, line 84
というエラーを吐いてきたんですよ。
エラー見ると、
$this->data["Model"]["how_know"]
という要素に格納されている値に問題あるみたいですね。
ちなみに、セレクトボックスと選択したした値(配列)が格納されています。
で、色々と調べてみると、Tableを使ってはいなくても、TableのSchema情報を定義しておけ、と。
つーことでModelを再設定します。
var $useTable = false; var $_schema = array("how_know"=>array("type"=>"string"));
これでエラーを吐かなくなりました。
- Newer: [釣り]5/17 アオリイカ釣り@館山
- Older: [Postfix]携帯メールアドレスの受信設定。
Trackbacks:0
- Trackback URL for this entry
- http://ore.saizensen.net/archives/74/trackback
- Listed below are links to weblogs that reference
- [cakephp]テーブル未使用モデルで$this->Model->create()するとエラー吐くよ。 from おれ最前線ねっと




