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

Matt S Trout dbix-class at trout.me.uk
Fri Feb 8 07:46:30 GMT 2008


On Thu, Feb 07, 2008 at 12:01:03PM +0100, Emanuele Zeppieri wrote:
> 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 ;-)

It would be desirable but other classes with a similar purpose would
likely also want that behaviour.

Basically, I'm saying "I agree there should be a general mechanism to
make this possible but I don't want the special-case hack since that's not
in keeping with the DBIC philosophy".

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list