Greetings Catalystery: Got a new question, trying to implement a
many_to_many
relationship via Moose... The DBIC portion of the puzzle is straightforward,
we've got
that working just fine.

Here's part I understand -- we have a controller that's referring to a form:

has 'form' => (
    isa     => 'MyApp::Controller::Incident::IncidentForm',
    is      => 'rw',
    lazy    => 1,
    default => sub { MyApp::Controller::Incident::IncidentForm->new },
)

then

$c->stash->{form} = $self->form; # etc

Piece of cake!



But how would you represent and then refer to a *many_to_many* relationship
such as

has 'actor_role' => (
    isa     => 'MyApp::Controller::DB::Result::ActorRole',
    is      => 'rw',
    lazy    => 1,
#  default => sub { MyApp::Controller::DB::Result::ActorRole->new }, # not!
#  default => sub { ...->add_to_roles(??) }
)

And then once we get the "has" straightened out, how do we use it?

%roles = $self->actor_role( @get_roles ); # ??
@success = $self->actor_role( %set_new_roles ); # ??

I've looked through
http://search.cpan.org/~frew/DBIx-Class-0.08124/lib/DBIx/Class/Relationship.pm#many_to_many
until my eyes cross on their own :(



Or am I barking up the wrong tree?

-- 
Failure is not important. How you overcome it, is.
-- Nick Vujicic
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to