I am not sure if this has already been asked, but i couldnt find the
answer anywhere sad.gif
Anyway my question is
i have a controller,model and view
i dont want to use database/tables since persistance will be
webservice(soap) based.
and i am using cake_1.2.0.7296-rc2.
PHP Code
<?php
/**
* cheers_controller.php
*/
class CheersController extends AppController {
//it seems to work without defining this, but nevertheless:-/
$helpers = array('Form');
function add(){
if (!empty($this->data)) {
if ($this->Cheer->save($this->data)) {
$this->flash('Your post has been saved.', '/cheers');
}else
{
$this->flash('Your post has NOT been saved.', '/
cheers');
}
}
}
}
/**
* cheer.php
*/
class Cheer extends AppModel
{
var $name = "Cheer";
var $useTable = false;
}
/**
* add.ctp
*/
echo $form->create('Cheer');
?>
throws this error
CODE
Fatal error: Call to a member function schema() on a non-object in C:
\xampp\htdocs\cake_1.2.0.7296-rc2\cake\libs\view\helpers\form.php on
line 127
what more do i need to do? after much googling it looks like i have to
override schema() function in my model.
but i cant seem to figure out how? i tried to return a array but still
doesnt work
PHP Code
<?php
/**
* cheer.php
*/
class Cheer extends AppModel
{
var $name = "Cheer";
var $useTable = false;
var $_schema = array(
'uid' => array('type' => 'string','null' => 1, 'default' =>
'','length' => 30),
'msg' => array('type' => 'string','null' => 1, 'default' =>
'','length' => 30),
'senderId' => array('type' => 'string','null' => 1,
'default' => '','length' => 30)
);
function schema($field = false)
{
return $this->_schema;
}
}
?>
Any help, direction would be a greatly appreciated.
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment