The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DBIx::Class::Valiant::Result - Base component to add Valiant functionality

SYNOPSIS

    package Example::Schema::Result::Person;

    use base 'DBIx::Class::Core';

    __PACKAGE__->load_components('Valiant::Result');

Or just add to your base Result class

    package Example::Schema::Result;

    use strict;
    use warnings;
    use base 'DBIx::Class::Core';

    __PACKAGE__->load_components('Valiant::Result');

DESCRIPTION

CONTEXTS

When doing an insert / create on a result, we automatically add a 'create' context which you can use to limit validations to create events. Additionally for an update we add an 'update' context.

CLASS METHODS

This component adds the following class or package methods to your result classes. Please note this is only class methods added by this package, it does not cover those which are aggregated from the Valiant::Validates role.

auto_validation (Boolean)

Defaults to true. When true Valiant will first perform a validation on the existing result object (and any related objects nested under it which have been loaded from the DB or created) and if there are validation errors will skip persisting the data to the database. You can use this to disable this behavior globally. Please not there are features to enable skipping auto validation on a per result/set basis as well.

accept_nested_for (field => \%options)

Allows you to update / create related objected which are nested under the parent (via has_one, might_have or has_many defined relationships).

METHODS

This component adds the following object methods. Please note this is only class methods added by this package, it does not cover those which are aggregated from the Valiant::Validates role.

is_marked_for_deletion

Will be true if the result has been marked for deletion. You might see this in a related result nested under a parent when an update calls for the record to be deleted but validation errors prevented the deletion from occuring.

build

AUTHOR

John Napiorkowski email:jjnapiork@cpan.org

SEE ALSO

Valiant, DBIx::Class

COPYRIGHT & LICENSE

Copyright 2020, John Napiorkowski email:jjnapiork@cpan.org

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.