[Dbix-class] ResultSet->new() ignores custom result_class [patch + tests]

Emanuele Zeppieri ema_zep at libero.it
Thu Feb 7 11:01:03 GMT 2008


Matt S Trout wrote:

> On Wed, Feb 06, 2008 at 08:23:00PM +0100, Emanuele Zeppieri wrote:
>> or when we use search_related() or $rs->page() (please check the 
>> attached test script for even more failing cases).
> 
> search_related doesn't preserve the result_class and it isn't logical for
> it to do so. A search_related traverses the relationship on the source.

Sorry Matt, after re-reading this, I think it probably needs a 
clarification as well (also by me).

I perfectly agree that search_related() must *not* preserve the 
result_class in any case: that would be an error (it's even covered in 
the current DBIC test suite, so it would break some tests.)

What my patch does here is not /blindly/ preserving the result_class in 
any case: it preserves it *only* when result_class has been set to 
'DBIx::Class::ResultClass::HashRefInflator', in *no* other case than 
that. (Indeed my patch breaks no existing test.)

I understand that's not the most elegant solution (it just modifies an 
existing temp fix anyway), but in the meantime it makes HashRefInflator 
work also with search_related(), which could be a desirable behaviour.

Well, just to be sure that that was sufficiently clear, before you 
rejected it ;-)

Cheers,
Emanuele.



More information about the DBIx-Class mailing list