Add from_bare_hash to Fieldmapper.pm.
authorJason Stephenson <jstephenson@mvlc.org>
Thu, 26 Sep 2013 05:53:35 +0000 (01:53 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Fri, 9 May 2014 15:07:07 +0000 (11:07 -0400)
commit7f890e17dc28b5b2deb5532528abd38a058eb292
treee23e973eaf9d608772eb8401aedc63508ba2c835
parent2e62dd3d8417e5b2034f27594b700906f73d3464
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