$obj->set( %$this_class_params );
$obj->update;
}
-
+
return ($obj,$errors);
}
my ($class,$r) = @_;
my $errors;
my $this_class_params = { map { $_ => $r->{params}{$_} } $class->columns };
- my $obj = eval { My::DBI->create( $this_class_params ) };
+ my $dfv_results;
+ my $obj;
- my $dfv_results = ($obj) ? undef : $class->dfv_results->msgs ;
+ if ($class->isa('Class::DBI::DFV')) {
+ $obj = eval { My::DBI->create( $this_class_params ) };
+ $dfv_results = ($obj) ? undef : $class->dfv_results ;
+ } else {
+ $dfv_results = Data::FormValidator->check($r->{params}, $class->dfv_profile);
+ if ($dfv_results->success) {
+ $obj = $class->create($this_class_params);
+ }
+ }
# handle dfv errors
if ( $dfv_results->has_missing ) { # missing fields
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 13;
+use Test::More tests => 15;
use_ok('Maypole::Application');
use_ok('Maypole::Constants');
use_ok('Maypole::Model::CDBI::DFV');
}
+use_ok('Maypole::View::Base');
+use_ok('Maypole::View::TT');
die "couldn't connect to mysql" unless (@databases);
};
warn "error : $@ \n" if ($@);
- my $testcount = ($@) ? 45 : 65 ;
+ my $testcount = ($@) ? 45 : 64 ;
plan tests => $testcount;
}
}
foreach my $colname (keys %correct_nullables) {
- ok( $DB_Class->column_required($colname) == !$correct_nullables{$colname}, "nullable column $colname is required (via column_required)" )
+ ok( $DB_Class->column_required($colname) == !$correct_nullables{$colname}, "nullable column $colname is required (via column_required)" )
}
- ok($DB_Class->required_columns([qw/score/]), 'set required column(s)');
+ ok($DB_Class->required_columns([qw/style name tasted score/]), 'set required column(s)');
foreach my $colname ( @{$DB_Class->required_columns()} ) {
ok($correct_nullables{$colname} == 0 || $colname eq 'score',"nullable or required column $colname is required (via required_columns)" );