Lines 13-18
use Carp qw( carp );
Link Here
|
13 |
use Module::Load qw( load ); |
13 |
use Module::Load qw( load ); |
14 |
use String::Random; |
14 |
use String::Random; |
15 |
use List::Util qw( any ); |
15 |
use List::Util qw( any ); |
|
|
16 |
use Array::Utils qw( array_minus ); |
16 |
|
17 |
|
17 |
use constant { |
18 |
use constant { |
18 |
SIZE_BARCODE => 20, # Not perfect but avoid to fetch the value when creating a new item |
19 |
SIZE_BARCODE => 20, # Not perfect but avoid to fetch the value when creating a new item |
Lines 281-290
sub _buildColumnValues {
Link Here
|
281 |
my @columns = $self->schema->source($source)->columns; |
282 |
my @columns = $self->schema->source($source)->columns; |
282 |
my %unique_constraints = $self->schema->source($source)->unique_constraints(); |
283 |
my %unique_constraints = $self->schema->source($source)->unique_constraints(); |
283 |
|
284 |
|
284 |
for my $key ( keys %{$original_value} ) { |
285 |
my @passed_keys = grep { ref($original_value->{$_}) ne 'HASH' } keys %$original_value; |
285 |
die "value passed for unrecognised column: $key" |
286 |
my @minus = array_minus( @passed_keys, @columns ); |
286 |
if !( any { $key eq $_ } @columns ); |
287 |
die "Error: value hash contains unrecognized columns: ". (join ',', @minus) if @minus; |
287 |
} |
|
|
288 |
|
288 |
|
289 |
my $build_value = 5; |
289 |
my $build_value = 5; |
290 |
# we try max $build_value times if there are unique constraints |
290 |
# we try max $build_value times if there are unique constraints |
291 |
- |
|
|