Stanis Trendelenburg wrote:
> Matt S Trout wrote:
>> In a word, "yes". It's a limitation of the current implementation; patches 
>> welcome or one of the existing devs will get round to it when we have tuits.
> 
> OK, thanks for the clarification.
> 
> After reading some more of the documentation and looking at
> Relationship/ManyToMany.pm I see why this is the case.
> The many_to_many accessor returns a resultset created by
> 
>   $self->search_related($rel)->search_related($f_rel)
> 
> where $rel is the has_many relation from the original class to the
> mapping class, and $f_rel the belongs_to relation from the mapping class
> to the wanted class.
> If I understand this correctly, this new resultset has no information
> about the current object (like prefetched values).
> 
> What do you think of the following patch to the many_to_many accessor:
> When the accessor is called in list context without arguments, return
> the objects directly (which will use the prefetched values) instead
> of returning the resultset from search_related().

Weeel ... it's ok.

But wouldn't it be better to make search_related check the prefetch attr and 
copy the appropriate stuff from the cache instead?

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to