https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24528
Marcel de Rooy <m.de.r...@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98200|0 |1 is obsolete| | --- Comment #11 from Marcel de Rooy <m.de.r...@rijksmuseum.nl> --- Created attachment 98213 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98213&action=edit Bug 24528: Add *_count support to to_api This patch adds a way to tell to_api an attribute needs to be calculated as the count on an existing method/relationship result. For example, if we wanted to include the holds_count attribute for a Koha::Patron object, we would call it: $ patron_json = $patron->to_api({ embed => { holds_count => { is_count => 1 } } }); This way to_api will internally call $json->{holds_count} = $self->holds->count; To test: 1. Apply the tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests fail! 3. Apply this patch 4. Repeat (2) => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: David Nind <da...@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.r...@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org 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/