Add from_bare_hash to Fieldmapper.pm.
authorJason Stephenson <jstephenson@mvlc.org>
Thu, 26 Sep 2013 05:53:35 +0000 (01:53 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 10 Feb 2014 15:40:13 +0000 (10:40 -0500)
commitbe5153a7db5570f66004c5869580e33856b98d62
tree7eb90832b61505ff37067e0bec308828bb9f204e
parent88363457b5e78807a34e6ac2b2a836b9249610ab
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>
Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm