Ian Docherty wrote:
> I am using Moose, but I don't think that is the problem.
> 
> I want to over-ride 'new' whenever I create a 'Demo' object and add a
> Class::Workflow object to my DBIx::Class object. My code is:-
> ----------------
> package MyApp::Domain::Result::Demo;
> 
> use Moose;
> use Class::Workflow;
> 
> BEGIN {
> extends 'DBIx::Class';
> };
> 
> has 'workflow' => (
>    is          => 'rw',
>    isa         => 'Class::Workflow',
> );
> 
> __PACKAGE__->load_components(qw(PK::Auto Core));
> __PACKAGE__->table('demo');
> __PACKAGE__->add_columns(qw(id name value state creator owner));
> __PACKAGE__->set_primary_key('id');
> 
> sub new {
>    my ($class, $attrs) = @_;
> 
>    my $workflow = Class::Workflow->new;
>    my $new = $class->next::method($attrs);
> 
> # Neither of the following two work, both give the same error (see below)
>    $new->{workflow} = $workflow;
>    $new->workflow($workflow);
> }
> ----------------
> 
> Both the ways I try to add the $workflow object (or any other data type
> actually) gives an error similar to the following.
> 
> Caught exception in MyApp::Web::Controller::Workflow::Intro->index
> "Can't locate object method "insert" via package "Class::Workflow"
> at /usr/lib/perl5/site_perl/5.8.8/DBIx/Class/ResultSet.pm line 1553."
> 
> I can create a Class::Workflow object outside of DBIx::Class without any
> problem. I just can't combine the two.
> 
> Any ideas?
> 
> Regards
> Ian

While I have no answer to your problem (try inflate_result instead?)...
Just out of curiosity, what ya doing combining the two. Sounds interesting.

-=Chris

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
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/[EMAIL PROTECTED]

Reply via email to