On Sat, Nov 03, 2007 at 06:23:57PM +0100, Ben Staude wrote:
> Hi,
> 
> I have a setup like the many_to_many-example Actor/Role in the docs, but the 
> Actor has another many_to_many relationshiop to, for example, languages:
> 
> Actor->many_to_many(roles=> 'actor_roles', 'role');
> Actor->many_to_many(languages => 'actor_languages', 'language');
> 
> When selecting an Actor, I'd like to prefetch his roles and languages. I'm 
> not 
> yet sure whether this really makes sense with respect to performance for my 
> application, but at least I want to understand what's going wrong when trying 
> to do so:
> 
> # Get actors by ids
> my @actors = $schema->resultset('Actor')->search(
>                 { 'me.id' => { -in => [EMAIL PROTECTED] } },
>               { prefetch => { actor_roles => 'role',
>                               actor_languages => 'language' } })->all;

We can't currently prefetch more than one has_many rel at the same level.

Sorry.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

_______________________________________________
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