Sorry about that. The error was there there was no SQL. The issue was
CakePHP requires you to overide _schema.
I solved the problem with the following:
class Workorder extends AppModel
{
var $useTable = false;
var $_schema = array(
'id'=> array('type' => 'integer', 'null' => '', 'default'
=>'', 'length' => '10', 'key'=>'primary'),
'workorder' => array('type' => 'string' , 'null' => '', 'default'
=>'', 'length' => '255')
);
public function __construct()
{
parent::__construct();
}
public function fetchWorkOrders()
{
$data = array();
$data[]['Workorder'] = array('id' => '01', 'workorder' =>
'Move outlet');
$data[]['Workorder'] = array('id' => '02', 'workorder' =>
'Add outlet');
$data[]['Workorder'] = array('id' => '03', 'workorder' =>
'Turn on HBO');
$data[]['Workorder'] = array('id' => '04', 'workorder' =>
'Allow PPV');
$data[]['Workorder'] = array('id' => '05', 'workorder' =>
'Add device');
return $data;
}
}
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of brian
Sent: Wednesday, February 25, 2009 12:51 PM
To: [email protected]
Subject: Re: Not using a DB for data
And the SQL error is ...?
On Wed, Feb 25, 2009 at 10:49 AM, RhythmicDevil <[email protected]>
wrote:
>
> Hi,
> I have a set of views in my app that will not be using a database. The
> data will be coming from an web method. I believe I still need to use
> a model to stay within MVC. So I have my model set up like this with a
> test method:
>
> class Workorder extends AppModel
> {
> var $useTable = false;
>
> public function fetchAllWorkdOrders()
> {
> $data = array();
>
> $data[] = array('id' => '01', 'workorder' => 'Move
> outlet');
> $data[] = array('id' => '02', 'workorder' => 'Add
> outlet');
> $data[] = array('id' => '03', 'workorder' => 'Turn on
> HBO');
> $data[] = array('id' => '04', 'workorder' => 'Allow
> PPV');
> $data[] = array('id' => '05', 'workorder' => 'Add
> device');
>
> return $data;
> }
> }
>
> However when I try to access the index view that calls the
> fetchAllWorkOrders method I get a SQL error even though I specified
> not to use a table. Are there other steps to let the model know that
> it does not use a db? Or am I on the wrong path?
>
> Thanks
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---