[Koha-bugs] [Bug 22700] Make biblio_metadata prefetchable from Koha::Biblio

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Apr 16 13:32:39 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22700

--- Comment #4 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
Comment on attachment 87943
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=87943
Bug 22700: Make biblio_metadata prefetchable from Koha::Biblio

Review of attachment 87943:
 --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=22700&attachment=87943)
-----------------------------------------------------------------

This doesn't feel entirely correct yet I'm afraid.. though I'm not close enough
to the biblio_metadatas table to entirely understand whether we expect it to
every be a more than one-to-one relationship with the biblio's table.

::: Koha/Biblio.pm
@@ +74,4 @@
>  sub metadata {
>      my ( $self ) = @_;
>  
> +    my $metadata_rs = $self->_result->biblio_metadatas->single;

Surprised this doesn't throw a warning?

https://metacpan.org/pod/DBIx::Class::ResultSet#single implies that calling
'single' on a 'has_many' (when prefetched) should throw one.

Also, as discussed in bug 22407 it would be nice to rename the underlying dbic
relationship to match the Koha::Object relation accessor (we could also code
said relationship to explicitly return a single related row rather than the
possibility of a ResultSet)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list