Several new methods have been added recently to retrieve the number of elements returned (items_count, subscriptions_count, etc.) We should find a way to avoid that, as the callers can call ->count easily.
Removing the introduced *_count methods will be a follow-up for this new feature if that's ok with you, Jonathan. I mean part of this bug.
Created attachment 97746 [details] [review] Bug 24467: Remove _count methods Add a trick to guess what we need to call. Note that it does not work, do not know why. Tests are missing to make sure everything is ok.
This is what I had in mind.
(In reply to Jonathan Druart from comment #3) > This is what I had in mind. Nice, I would prefer the + separator. And was waiting for bug 24356 and the work Agustin is doing for sorting and filtering on related tables.
Created attachment 98198 [details] [review] Bug 24467: Remove _count methods introduced for API use This patch removes some methods that were introduced for API usage in the first iteration of the object embedding development effort. Those methods were obsoleted by bug 24528, which introduces a smarter way for Koha::Object->to_api to embed *_count attributes on the output structure based on the relationships and a call to ->count. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t => SUCCESS: Tests pass 3. Sign off :-D
Created attachment 98202 [details] [review] Bug 24467: Remove _count methods introduced for API use This patch removes some methods that were introduced for API usage in the first iteration of the object embedding development effort. Those methods were obsoleted by bug 24528, which introduces a smarter way for Koha::Object->to_api to embed *_count attributes on the output structure based on the relationships and a call to ->count. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t => SUCCESS: Tests pass 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
Created attachment 98218 [details] [review] Bug 24467: Remove _count methods introduced for API use This patch removes some methods that were introduced for API usage in the first iteration of the object embedding development effort. Those methods were obsoleted by bug 24528, which introduces a smarter way for Koha::Object->to_api to embed *_count attributes on the output structure based on the relationships and a call to ->count. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t => SUCCESS: Tests pass 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 98219 [details] [review] Bug 24467: (QA follow-up) Fix POD in Koha::Biblio Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 98220 [details] [review] Bug 24467: (QA follow-up) Clarify tests wording for ->count methods Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Nice work everyone! Pushed to master for 20.05
Enhancement not backported to 19.11.x