Angel Kolev [mailto:[EMAIL PROTECTED] wrote:
> Thank you.
> It works, but only when prefetch only 1 table. If i try to do it with
both:
> my $rs = $c->model('AppModelDB::ClientFemale')->search(undef,
> {
> join
=> [qw/ client_family client_male /],
> prefetch
=> [qw/ client_family client_male /]
> });
> .. the result is:
>
> No such relationship client_male at
/usr/local/share/perl/5.8.8/DBIx/Class/Schema.pm line 945
DBIx::Class::Schema::throw_exception('AppModelDB=HASH(0x927aab4)', 'No
such relationship client_male'................etc
> I only can use prefetch AppModelDB::ClientFemale -> client_family
andAppModelDB::ClientMale -> client_family. The relationships are
has_many and may_to_many. The "Family" table have
"_PACKAGE__->belongs_to" for both tables.
Your join and prefetch attributes must be nested hashrefs:
my $rs = $c->model('AppModelDB::ClientFemale')->search(undef,
{ join => { client_family => 'client_male' },
prefetch => { client_family => 'client_male' },
{
);
HTH,
Jason
_______________________________________________
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]