[Dbix-class] Issue when prefetching two level deep has_many relationships

Matt S Trout dbix-class at trout.me.uk
Fri Sep 22 19:17:03 CEST 2006


Nilson Santos Figueiredo Junior wrote:
> 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.

Give me a failing test rather than a mailing list thread and I'll fix it.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list