this function is called to re-init result_errors before call validate function
=cut
sub_erase_result_error
{
my$self= shift;
$self->result_errors(undef);
}
=head1 VALIDATION METHOD
set of function to validate fields
=cut
=head2 validate_enum function
validation of the enum field, should return a validation error if the field is set and is not in the list of enum
=cut
subvalidate_enum {
my($self, $field) = @_;
$self->add_result_error( $field, $field." must be set with one of the following value: ".join(", ", @{$self->result_source->columns_info->{$field}->{extra}->{list}}) )
$self->add_result_error( $field, "$field has no data_type defined, it must be defined when prohibit_field_update is used") if(!defined$self->result_source->columns_info->{$field}->{data_type});
$self->add_result_error( $field, "$field can not be updated to ".$self->$field." : Not authorized") if(!defined$previous_field_value|| $previous_field_value!= $self->$field);
}
else{
$self->add_result_error( $field, "$field can not be updated to ".$self->$field." : Not authorized") if(!defined$previous_field_value|| $previous_field_valuene $self->$field);
}
}
}
1;
__END__
=head1 SEE ALSO
L<"DBIx::Class">
=head1 AUTHOR
Nicolas Oudard <nicolas@oudard.org>
=head1 CONTRIBUTORS
=head1 LICENSE
You may distribute this code under the same terms as Perl itself.
Keyboard Shortcuts
Global
s
Focus search bar
?
Bring up this help dialog
GitHub
gp
Go to pull requests
gi
go to github issues (only if github is preferred repository)