https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41950
--- Comment #16 from Tomás Cohen Arazi (tcohen) <[email protected]> --- (In reply to Jonathan Druart from comment #15) > 1. This needs to be documented somewhere Agreed. > 2. It was not clear to me why we couldn't sort by checkout count, so I've > added > > @ Koha/Schema/Result/Borrower.pm:2271 @ __PACKAGE__->has_many( > +__PACKAGE__->has_many( > + "checkouts", > + "Koha::Schema::Result::Issue", > + { "foreign.borrowernumber" => "self.borrowernumber" }, > + { cascade_copy => 0, cascade_delete => 0 }, > +); > > And it's now possible: > curl -u koha:koha --request GET > 'http://dev-intra.localhost/api/v1/patrons?_order_by=+me.checkouts_count' > --header "x-koha-embed: checkouts+count" --header "Content-Type: > application/json"|jq > > However the test is now failing. Wouldn't it better to add the relationship > directly in dbic as it's certainly one of the biggest need for this feature? > > Especially because you advertise it in comment 0. The whole point was to make something generic, that pairs with the existing pattern. if we were to add _count relationships everywhere then we would need do a lot of scaffolding for adding a `+count` embed which we just want to avoid i.e. if you have a relationship, you can now embed the count automagically, and this patch makes it sortable? -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
