I want to prefetch both a single hop relation and a two-hop 
relation.

I.e. I want to combine this:

    my $rs = $schema->resultset('Foo')->search(
        {   'me.foo_id' => $foo_id, },
        {   prefetch    => {
                bar         => 'biz',
            },
        },
    );

with this:

    my $rs = $schema->resultset('Foo')->search(
        {   'me.foo_id' => $foo_id, },
        {   prefetch    => 'baz',   },
    );

But this doesn't work, probably obviously:

    my $rs = $schema->resultset('Foo')->search(
        {   'me.foo_id' => $foo_id  },
        {   prefetch    => {
                bar         => 'biz',
            },
        },
        {   prefetch    => 'baz'    },
    );

But this doesn't work either, because there is no 'baz to baz':

    my $rs = $schema->resultset('Foo')->search(
        {   'me.foo_id' => $foo_id  },
        {   prefetch    => {
                bar         => 'biz',
                baz         => 'baz',
            },
        },
    );

Any way to do this?

I still don't follow adding joins.  If I add the second one as
a join, it doesn't work either, and no error - just an empty $rs.

Mark

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/

Reply via email to