[Catalyst] auto-generate ResultSet classes?
J. Shirley
jshirley at gmail.com
Thu May 28 02:07:35 GMT 2009
On Wed, May 27, 2009 at 6:52 PM, Jarom Smith <jarom at jaromsmith.net> wrote:
> Yes, I was thinking a very simple stub ResultSet class for every Result
> source. Something like:
>
> package MyApp::Schema::ResultSet::MyTable;
>
> use strict;
> use warnings;
>
> use base 'DBIx::Class::ResultSet';
>
> # example
> #sub get_by_id {
> # my $self =3D shift;
> # my $id =3D shift;
> #
> # return $self->find($id)->all;
> #}
>
> 1;
>
> In practice, it may be overkill to create a ResultSet class for each Resu=
lt
> class, and admittedly it's not too difficult to create these ResultSet
> classes by just doing one and copying as needed. I'm probably being lazi=
er
> than I should be...
>
>
> jarom smith
> tech go-to guy
>
>
> J. Shirley wrote:
>
>> On Wed, May 27, 2009 at 5:31 PM, Jarom Smith <jarom at jaromsmith.net<mailt=
o:
>> jarom at jaromsmith.net>> wrote:
>>
>> Sorry, one more question (and this one does have to do with Catalyst
>> more than DBIC, I think...)
>>
>> Is there any magical invocation for the create script which will
>> make a bunch of stub ResultSet classes for me, similar to how the
>> Result classes are auto-generated when I do
>>
>> script/myapp_create.pl model MyAppDB DBIC::Schema MyApp::Schema
>> create=3Dstatic components=3DTimeStamp,EncodedColumn dbi:mysql:myapp
>> 'dbuser' 's3kr1t' '{ AutoCommit =3D> 1 }'
>>
>> ? (and if so, what is it?)
>>
>> thanks,
>>
>> jarom smith
>> tech go-to guy
>>
>>
>> What do you want/expect the resultset classes to contain? Or do you want
>> a resultset class created for every result source?
>>
>> I've found that using a custom resultset default via load_namespaces sui=
ts
>> most of my needs, but I'd be interested to hear other scenarios.
>>
>> Thanks,
>> -J
>>
>>
Catalyst::Helper::Model::DBIC::Schema doesn't do that, but you could submit
a patch :)
-J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090527/b176a=
1d5/attachment.htm
More information about the Catalyst
mailing list