DBIx:.Class::Candy + DBIx::Class::DynamicSubclass ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DBIx:.Class::Candy + DBIx::Class::DynamicSubclass ?

Marco Vittorini Orgeas
Hi,
I'm trying to combine Candy with the functionality of
DBIx::Class::DynamicSubclass and it seems the Candy's export/import
"magic" get in the way of DynamicSubclass, so something like that:

> use utf8;
> package App::Schema::Result::User;
>
> use Moose;
> use MooseX::NonMoose;
> use MooseX::MarkAsMethods autoclean => 1;
> use DBIx::Class::Candy -autotable => v1,
> -components => ['InflateColumn::DateTime',
> 'TimeStamp',
> 'InflateColumn::ClassTypeEnum',
> 'DynamicSubclass',
> ];
>
> =head1 COMPONENTS LOADED
>
> =over 4
>
> =item * L<DBIx::Class::InflateColumn::DateTime>
>
> =item * L<DBIx::Class::TimeStamp>
>
> =item * L<DBIx::Class::InflateColumn::ClassTypeEnum>
>
> =back
>
> =head1 TYPECAST MAP
>
> =head2 Map of users type for single-table inheritance
>
> Doctor => App::Schema::Result::Doctor
> Assistant => App::Schema::Result::Assistant
>
> =cut
>
> __PACKAGE__->typecast_map(type => {
>         'Doctor' => 'App::Schema::Result::Doctor',
>         'Assistant' => 'App::Schema::Result::Assistant',
> });

Dies with:
> Couldn't instantiate component "App::Model::DB", "{UNKNOWN}: Can't locate object method "result_source_instance" via package "App::Schema::Result::User" at (eval 634) line 18.
> Compilation failed in require at /home/marco/.perlbrew/libs/perl-5.22.1/lib/perl5/Class/C3/Componentised.pm line 150. at /home/marco/.perlbrew/libs/perl-5.22.1/lib/perl5/Class/C3/Componentised.pm line 155
> Compilation failed in require at /home/marco/.perlbrew/libs/perl-5.22.1/lib/perl5/Catalyst/Test.pm line 155.
> BEGIN failed--compilation aborted at t/01app.t line 6.
> t/01app.t .............. Dubious, test returned 255 (wstat 65280, 0xff00)
> No subtests run

because this line:
> my $real_columns = $this->result_source_instance->_columns;
(https://metacpan.org/source/SYBER/DBIx-Class-DynamicSubclass-0.03/lib/DBIx/Class/DynamicSubclass.pm#L159)
expects to find a "result_source_instance" method which candy seems to
have cleaned up.

Do I have any alternatives to get that method at run-time with Candy, or
should I give up and don't use the Candy module?

Thank you.

Marco

_______________________________________________
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@...