You can make a Report model without table and just create a schema()
method.
Something like this :
class Reportl extends AppModel {
var $name = 'Reportl';
var $useTable = false;
var $validate = array('name' => array('rule' =>
VALID_NOT_EMPTY,
'message' =>
'mandatory'),
'email' => array('rule' => 'email',
'message' =>
'invalidmail'),
);
function schema($clear = false)
{
if (!is_array($this->_schema) || $clear) {
$this->_schema = array('name' => array('type' => 'string',
'length' => 128),
'email' => array('type' =>
'string', 'length' => 64),
);
}
return $this->_schema;
}
hth
On May 5, 4:20 am, mark_nsx <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Im working on a contact us/feedback form that doesn't have an
> underlying model.
> Basically what I'm trying to do is just to ensure that all the fields
> in the form aren't empty.
> In my class I have the function:
>
> class Report extends AppModel {
> var $name = 'Report';
>
> }
>
> class ReportController extends AppController {
> var $name = 'Report';
> var $uses = null;
>
> function report($arg_1) {
> if (empty($arg_1)) {
> $this->Report->invalidate('field1');
> }
> }
>
> }
>
> Im getting errors like:
> Fatal error: Call to a member function invalidate() on a non-object.
>
> Am I missing something? or do I just need to provide a table in order
> for me to use
> invalidate? 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
-~----------~----~----~----~------~----~------~--~---