On Tue, 26 Feb 2008, Matt Lawrence wrote:

Jess Robinson wrote:

On Tue, 26 Feb 2008, Matt Lawrence wrote:

Rubbish, whatever gave you that idea?

Docs say:

|prefetch| can be used with the following relationship types: |belongs_to|, |has_one| (or if you're using |add_relationship|, any relationship declared with an accessor type of 'single' or 'filter').

Then docs are bork, which doc is that?

You can now fetch a has_many quite happily, the only thing that doesnt work, iirc, is fetching 2 has_manys at the same level.

You can indeed prefetch a has_many rel.

Excellent. How does that work? Do you get one instance of each object with a prepopulated resultset?

Err, it works just like you called the rel, so if you fetched author and prefetched books, then $author->books in scalar context is a resultset with no extra query, and in list context its a list with no extra query.

Jess

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to