Added has_column and column_info methods
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / AccessorMapping.pm
index 1604a7c..2489d3f 100644 (file)
@@ -17,6 +17,7 @@ sub mk_group_accessors {
     my $wo_meth = ($class->can('mutator_name')
                     ? $class->mutator_name($col)
                     : $col);
+    #warn "$col $ro_meth $wo_meth";
     if ($ro_meth eq $wo_meth) {
       $class->NEXT::ACTUAL::mk_group_accessors($group => [ $ro_meth => $col ]);
     } else {
@@ -28,10 +29,10 @@ sub mk_group_accessors {
 
 sub create {
   my ($class, $attrs, @rest) = @_;
-  die "create needs a hashref" unless ref $attrs eq 'HASH';
+  $class->throw( "create needs a hashref" ) unless ref $attrs eq 'HASH';
   $attrs = { %$attrs };
   my %att;
-  foreach my $col (keys %{ $class->_columns }) {
+  foreach my $col ($class->columns) {
     if ($class->can('accessor_name')) {
       my $acc = $class->accessor_name($col);
 #warn "$col $acc";