Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hi fellow Perl hackers, I am working on a large application in which I use DBIX::Class as an ORM. I have a 'Document' resultset that is linked up to a large number of other resultsets using many_to_many relations. This allows me to define what documents are related to other database objects. Now I want to get a list of Documents, easy:
my $documents = $schema->resultset('Document')->search();
For every document that is returned I want to display to which other objects it is actually connected using a many_to_many relation without manually having to go through all the many_to_many relations the object has. This allows me to more easily expand the number of objects the 'Document' object is connected to without having to redefine the code above. Can anyone tell me if it is possible to list which many_to_many relations a resultset has and which relations actually have a connected object?
while (my $document = $documents->next) { my $related_objects = $document->HOW_DO_I_DO_THIS(); ... }
If anyone can help me I would be VERY gratefull

In reply to 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 studying the Monastery: (1)
As of 2023-06-04 14:50 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (22 votes). Check out past polls.