Greetings Catalystery: Got a new question, trying to implement a many_to_many<div>relationship via Moose... The DBIC portion of the puzzle is straightforward, we've got</div><div>that working just fine.<br><div><br></div>
<div>Here's part I understand -- we have a controller that's referring to a form:</div><div><br></div><div>has 'form' => (</div><div> isa => 'MyApp::Controller::Incident::IncidentForm',</div>
<div> is => 'rw',</div><div> lazy => 1,</div><div> default => sub { MyApp::Controller::Incident::IncidentForm->new },</div><div>)</div><div><br></div><div>then</div><div><br></div><div>
$c->stash->{form} = $self->form; # etc</div><div><br></div><div>Piece of cake!</div><div><br></div><div><br></div><div><br></div><div>But how would you represent and then refer to a <b>many_to_many</b> relationship such as</div>
<div><br></div><div><meta charset="utf-8"><div>has 'actor_role' => (</div><div> isa => 'MyApp::Controller::DB::Result::ActorRole',</div><div> is => 'rw',</div><div> lazy => 1,</div>
<div># default => sub { MyApp::Controller::DB::Result::ActorRole->new }, # not!</div><div># default => sub { ...->add_to_roles(??) }</div><div>)</div></div><div><br></div><div>And then once we get the "has" straightened out, how do we use it?</div>
<div><br></div><div>%roles = $self->actor_role( @get_roles ); # ??</div><div>@success = $self->actor_role( %set_new_roles ); # ??</div><div><br></div><div>I've looked through</div><div><a href="http://search.cpan.org/~frew/DBIx-Class-0.08124/lib/DBIx/Class/Relationship.pm#many_to_many">http://search.cpan.org/~frew/DBIx-Class-0.08124/lib/DBIx/Class/Relationship.pm#many_to_many</a></div>
<div>until my eyes cross on their own :(</div><div><br></div><div><br></div><div><br></div><div>Or am I barking up the wrong tree?</div><div><br>-- <br>Failure is not important. How you overcome it, is.<br>-- Nick Vujicic<br>
</div></div>