[Dbix-class] Re: Get table name from ResultSet class?

Lyle Kopnicky lwk at rentrak.com
Wed Sep 21 22:22:16 GMT 2011

On Wed, Sep 14, 2011 at 11:28 AM, Alexander Hartmaier <
alexander.hartmaier at t-systems.at> wrote:

> Because the method foo is a method of the result (row) class and not the
> resultsource class.
> If you want to add resultsource methods you need to write a
> ResultSource::Table (or ::View) subclass and assign it to your result cla=
> __PACKAGE__->table_class('Your::Model::ResultSource::WithFooMethod');
>  Thanks, but this does not seem to work. I set the table_class on the
Result class as you said, but then when I get the ResultSource class, it
doesn't have the methods I defined:

package My::Schema::ResultSource::MyTable;

use Moose;
extends 'DBIx::Class::ResultSource::Table';

sub foo { ... }


package My::Schema::Result::MyTable;


my $schema =3D My::Schema->connect(...);
my $source =3D $schema->source('MyTable');

Blows up because foo is not found. In fact, the $source object is of class
My::Schema::ResultSource::Table, not my custom class.

-- =

Lyle Kopnicky | Software Developer
503.284.7581 x260 | lwk at rentrak.com <axc at rentrak.com>
RENTRAK | www.rentrak.com | NASDAQ: RENT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110921/5d0=

More information about the DBIx-Class mailing list