> > I don't think that's what you want. > > What you want is one *result source* per table, but only one class. So. > > Create a class My::Schema::Foo as normal. set ->table to '__VIRTUAL__' or > something. > > Then, after load_classes()/load_namespaces(), > > my $source = __PACKAGE__->source('Foo'); # get the resultsource created by > the Foo class > > foreach my $i (0 .. $max_table_numer) { > my $numbered_source = $source->new($source); > $numbered_source->table("foo_${i}"); > __PACKAGE__->register_source("Foo_${i}" => $numbered_source); > } > > Then your code can just do $schema->resultset("Foo_123") or whatever. > > Just fyi in case someone else tries to do this... This works except you have to replace ->table with ->name.
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk