Remove Class::Data::Inheritable and use CAG 'inherited' style accessors
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / GetSet.pm
index 80e941f..e948048 100644 (file)
@@ -4,7 +4,7 @@ package # hide from PAUSE
 use strict;
 use warnings;
 
-#use base qw/Class::Accessor/;
+use base 'DBIx::Class';
 
 sub get {
   my ($self, @cols) = @_;
@@ -17,6 +17,15 @@ sub get {
 
 sub set {
   my($self, %data) = @_;
+
+  # set_columns() is going to do a string comparison before setting.
+  # This breaks on DateTime objects (whose comparison is arguably broken)
+  # so we stringify anything first.
+  for my $key (keys %data) {
+    next unless ref $data{$key};
+    $data{$key} = "$data{$key}";
+  }
+
   return shift->set_columns(\%data);
 }