Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hi there, Thanks a lot for you answer! Although it did not exactly answer my question it taught me a LOT about DBIC that I did not know yet. Thanks for that! What I was actually looking for was fetching all many_to_many related objects without exactly knowing the names of the relations. I have solved it by doing:
my @related_models; # fetch relations from model. By doing it this way when new many_t +o_many relations are created, the controller automatically picks them + up my @relations = $self->schema->source('Document')->relationships() +; foreach (@relations) { if ($_ =~ m/(^.*)_documents$/) { push @related_models, $1; } } foreach (@related_models) { my ($relObj) = $object->$_(); #Assume only one object refe +rs to this one (business logic) if ($relObj) { $row{relatedObject} = $relObj->name(); $row{relatedObjectId} = $relObj->id(); $row{relatedObjectType} = $relObj->_source_handle->sou +rce_moniker; # Why is getting the source Name so difficult? } } push @data, \%row; } Again thanks for the very informative reply!

In reply to Re^2: list DBIX::Class many_to_many relations by misterb101
in thread list DBIX::Class many_to_many relations by misterb101

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2023-09-30 09:45 GMT
Find Nodes?
    Voting Booth?

    No recent polls found