]> git.evergreen-ils.org Git - working/Evergreen.git/commit
LP1223903 - Add from_bare_hash to Fieldmapper.pm.
authorJason Stephenson <jstephenson@mvlc.org>
Thu, 26 Sep 2013 05:53:35 +0000 (01:53 -0400)
committerBen Shum <bshum@biblio.org>
Wed, 19 Feb 2014 16:45:31 +0000 (11:45 -0500)
commitb9edf30f9f2e5bcda86c4724496e6261b64148a0
treed67222a770ce267314fb4fe4f1e1330178d708cd
parent6c16a446894d47776ec336115c096b165ffe4b6a
LP1223903 - Add from_bare_hash to Fieldmapper.pm.

Teach the Perl Fieldmapper.pm to build objects from a hashref in a
similar manner to how the JS Fieldmapper already can.  You might use
it if you retrieved a database row as a hashref, like so:

my $hashref = {};
my $class = Fieldmapper::class_for_hint('bre');
my $bre = $class->from_bare_hash($hashref);

We also modify the Fieldmapper's properties method to sort the array of
field names it returns by position.  This makes the return value a lot
more useful for on the fly object construction and other fancy tricks.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm