[Dbix-class] [DBIx-class] Can't find source for XXX question SOLVED
ejm
mansky at mindspring.com
Mon Dec 3 15:17:00 GMT 2018
Hi all,
In case anyone else has the issue of "Can't find source for XXX", my solution was to correct
the value of source_name.
I was specifying source_name in my Result class pkg to be the table name in the DB.
After looking at the code in DBIx::Class::Schema and the POD documentation, it seems that source_name should be the
final part of the class name for the corresponding Result for that table.
Once I changed the value of source_name, the query worked fine, returning all the expected data.
In my example, the change was:
package X::Y::Z::Result::Table1;
use base qw(DBIx::Class::Core);
... other Perl statements (strict, warnings, etc.)
__PACKAGE__->table('table1');
__PACKAGE__->resultset_class('X::Y::Z::ResultSet::Table1');
__PACKAGE__->source_name('Table1'); <--- table1 changed to Table1
... Accessor statements
1;
In my codebase, X::Y::Z represents the nested namespaces in the existing (large) Apache codebase that I am adding
DBIx functionality.
Thanks and regards,
--Ed
More information about the DBIx-Class
mailing list