in reply to Re: DBIx and ManyToMany Relationships
in thread DBIx and ManyToMany Relationships
Just thought I should also explain this: it is a common mistake to treat many-to-many accessors as a relationship accessor. Many-to-many is simply a bridge for convenience that allows you to retrieve records across a linker table without having to explicitly include the linker but you can't use it in a join or prefetch becasue it doesn't translate into a single table to join to for the SQL statement if that makes sense?
So instead, you have to define the actual "path" from the first table you query against to all teh tables you want to include and prefetch and yuo do that with hash refs like in the snippet I posted above, which means: "join to contentlinks and from contentlinks to repo".
$c->model('ORIdatabase::Repo')->search({}, {rows => '10'})->contents;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: DBIx and ManyToMany Relationships
by kiz (Monk) on May 30, 2012 at 11:22 UTC |