[Dbix-class] Issue when prefetching two level deep has_many relationships
Nilson Santos Figueiredo Junior
acid06 at gmail.com
Fri Sep 22 00:41:25 CEST 2006
On 9/21/06, Nilson Santos Figueiredo Junior <acid06 at gmail.com> wrote:
> I further dove into the code and I've found exactly where the problem
> is inside the _collapse_result() method. The following check should
> fail, however it succeeds:
>
> while (
> !(
> grep {
> !defined($tree->[0]->{$_}) || $co_check{$_} ne $tree->[0]->{$_}
> } @co_key
> )
> ) { ... }
No wonder it always succeeds, %co_check is defined as:
my %co_check = map { ($_, $tree->[0]->{$_}); } @co_key;
I think this probably means more than one level deep has_many
relationships are really broken. In an A has_many B has_many C
situation, whenever you've got a B that doesn't have any C's, the
following B rows will magically disappear from your resultset.
I honestly have no clue on how to fix it, hopefully someone else does.
I think I've already provided the best information I could on this
issue. This only affects prefetched has_many relationships.
-Nilson Santos F. Jr.
More information about the Dbix-class
mailing list