cakephp logo

Model field warning 512 try implementing a schema in CakePHP 1.2

While trying to implement a contact form with no table set (i.e. $useTable=false) I came across the following 512 warning :-

  • Warning (512): (FormHelper::create) Unable to use model field data. If you are using a model without a database table, try implementing schema() [CORE/cake/libs/view/helpers/form.php, line 124]
  • 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]

The solution to this warning was to create a schema manually as suggested by the warning messages, for example :-

Show Plain Text
PHP code
  1. var $_schema = array(
  2. 'name' => array('type' => 'string', 'length' => 25),
  3. 'email' => array('type' => 'string', 'length' => 25),
  4. 'message' => array('type' => 'text')
  5. );

Filed under: Cakephp  

0 Responses to “Model field warning 512 try implementing a schema in CakePHP 1.2”

Sorry, comments have been closed for this post.
(default) 11 queries took 21 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `posts`17171
2DESCRIBE `comments`11111
3DESCRIBE `tags`221
4DESCRIBE `categories`221
5DESCRIBE `posts_tags`221
6DESCRIBE `categories_posts`221
7SELECT `Post`.`id`, `Post`.`url`, `Post`.`title`, `Post`.`icon`, `Post`.`metadesc`, `Post`.`metakeys`, `Post`.`categories`, `Post`.`tease`, `Post`.`body`, `Post`.`private_body`, `Post`.`created`, `Post`.`modified`, `Post`.`status`, `Post`.`allow_comments`, `Post`.`tags`, `Post`.`hitcount`, `Post`.`hitcount_rss` FROM `posts` AS `Post` WHERE `Post`.`url` = 'model-field-warning-512-try-implementing-a-schema-in-cakephp-1-2' LIMIT 11114
8SELECT `Comment`.`id`, `Comment`.`post_id`, `Comment`.`body`, `Comment`.`author`, `Comment`.`url`, `Comment`.`email`, `Comment`.`ip`, `Comment`.`status`, `Comment`.`junk_score`, `Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment` WHERE `Comment`.`status` = 2 AND `Comment`.`post_id` = (8) 001
9SELECT `Tag`.`id`, `Tag`.`tag`, `PostsTag`.`post_id`, `PostsTag`.`tag_id` FROM `tags` AS `Tag` JOIN `posts_tags` AS `PostsTag` ON (`PostsTag`.`post_id` = 8 AND `PostsTag`.`tag_id` = `Tag`.`id`) 000
10SELECT `Category`.`id`, `Category`.`category`, `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id` FROM `categories` AS `Category` JOIN `categories_posts` AS `CategoriesPost` ON (`CategoriesPost`.`post_id` = 8 AND `CategoriesPost`.`category_id` = `Category`.`id`) 110
11UPDATE `posts` AS `Post` SET `Post`.`hitcount` = Post.hitcount + 1 WHERE `Post`.`id` = 810