[Dbix-class] Left join on multiple columns

John Goulah jgoulah at gmail.com
Fri May 18 22:13:40 GMT 2007


On 5/18/07, John Goulah <jgoulah at gmail.com> wrote:
>
> On 5/18/07, Guillermo Roditi <groditi at gmail.com> wrote:
> >
> > Correction, you want to add it to the ResultSet class, not the result
> > class! and yes there's a way.
> >
> > http://search.cpan.org/~blblack/DBIx-Class/lib/DBIx/Class/Manual/Cookbo=
ok.pod#Predefined_searches
> >
> > <http://search.cpan.org/%7Eblblack/DBIx-Class/lib/DBIx/Class/Manual/Coo=
kbook.pod#Predefined_searches>
> >
> > http://search.cpan.org/~jrobinson/DBIx-Class-0.07999_02/lib/DBIx/Class/=
Storage/DBI.pm
> >
> > <http://search.cpan.org/%7Ejrobinson/DBIx-Class-0.07999_02/lib/DBIx/Cla=
ss/Storage/DBI.pm>
> >
> > $self->result_source->schema->storage
>
>
>
>
>
> That makes sense, but for some reason when I follow the example it wont
> let me start my server.  I create a directory under myDB called ResultSet,
> and put an object call TestRes.pm in there which contains:
>
> package myDB::ResultSet::TestRes;
>
> use strict;
> use warnings;
> use base 'DBIx::Class::ResultSet';
>
> 1;
>
>
> and when I try to start the catalyst server I get:
>
> Couldn't instantiate component "MyApp::Model::myDB", "Cannot load schema
> class 'myDB': Can't locate object method "source_name" via package
> "myDB::ResultSet::TestRes" at
> /usr/local/share/perl/5.8.8/DBIx/Class/Schema.pm line 280.
> Compilation failed in require at
> /usr/local/share/perl/5.8.8/Catalyst/Model/DBIC/Schema.pm line 272.
>
> From searching the web it says to check the other classes mentioned in the
> error, all of which compile fine, and if I move the ResultSet folder out =
of
> my app, things are fine.  Pulling at straws, I defined a method called
> source_name, which then just leads the compiler to throw another error.
>
>
> Any Ideas?
>
> Thanks!
> John





Also, if I move the ResultSet folder out of myDB and put it in lib, I am
able to start the server, but I get the error:

 "DBIx::Class::Schema::__ANON__(): Can't find source for TestRes ......




I do have this in my table model schema class:
__PACKAGE__->resultset_class('ResultSet::TestRes');


And in my controller code I'm trying to call it like:
$c->model->resultset('TestRes')->get_test_result();

which is the line the error points to.


Thanks,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070518/367=
d57d9/attachment.htm


More information about the Dbix-class mailing list