RE: [Maypole] Adding a model class without a table

From: CUMMING, Joe, FM (Joe.CUMMING at rbos.com)
Date: Fri Sep 17 2004 - 09:12:06 BST


Hi Gabor,

I did this by overriding the "db_Main" routine in my model class to return
the desired database and then defining "__PACKAGE__->set_sql" subroutines
for the internal data queries. An example is below.

It works very well, though if anyone knows of a more elegant way to return
the db_Main handle I'd be delighted to know.

Thanks,

Joe

e.g.

package Tennis::Admin;

use Tennis:: Player;
use strict;

sub list :Exported {
    
    my ($self, $r) = @_;
        $r->objects([ $self->search_current_matches() ]);
        $r->{template} = "list";

}

sub db_Main {
 return "Tennis::Player"->db_Main
}

#-------------------------------------------------------------------------

__PACKAGE__->set_sql(current_matches => qq {select date from matches where
date > now()});

#-------------------------------------------------------------------------

1;

-----Original Message-----
From: maypole-admin at lists.netthink.co.uk
[maypole-admin at lists.netthink.co.uk] On Behalf Of Gabor Szabo
Sent: 16 September 2004 21:48
To: maypole at lists.netthink.co.uk
Subject: [Maypole] Adding a model class without a table

I am trying to add a model class that has no associated table.
It is supposed to show the results of all kinds of complex
queries using multiple tables.

I added a Module called Module::CPANTS::Maypole::Stats
and added a call to Module::CPANTS::Maypole::Stats->require;
I also created a template file

still when I acces /stats/show I get the

 file error - statsshow: not found at Maypole/View/Base.pm line 69.

is there a document that explains how to add a new model class ?

tx
Gabor

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole

***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority
 
This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.
                                                                                                        
Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The Royal
Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.
                                                                                                               Visit our websites at:
http://www.rbs.co.uk/CBFM
http://www.rbsmarkets.com
                                                                                                       ********************************************************************************

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT