https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22700 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Martin Renvoize from comment #4)
Comment on attachment 87943 [details] [review] Bug 22700: Make biblio_metadata prefetchable from Koha::Biblio
Review of attachment 87943 [details] [review]: -----------------------------------------------------------------
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.
It is a one-to-one relationship.
::: 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.
For a warning it requires more than one result. Something the schema allows, but the code doesn't.
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)
I agree with this, but I wouldn't consider this a blocker for this one. I will give it a try, though. -- You are receiving this mail because: You are watching all bug changes.