NAME

Data::Morph::Backend::DBIC - Provides a Data::Morph backend for DBIx::Class

VERSION

version 1.112770

DESCRIPTION

Data::Morph::Backend::DBIC implements a Data::Morph backend that talks to a database via DBIx::Class. New instances or rows are created from the passed in DBIx::Class::ResultSet to the constructor. Values are set and retrieved from the row using the following logic: If there is an accessor, use it, if not, see if it has a column, use inflated_columns methods, if not die. So directives defined in the map for reading and writing should match either accessors or column names

PUBLIC_ATTRIBUTES

result_set

is: ro, isa: DBIx::Class::ResultSet, required: 1

This attribute holds the active ResultSet that should be used when creating new rows

auto_insert

is: ro, isa: Bool, default: false

During the execution of the "epilogue", this attribute is checked to see if the newly created and populated instance should be inserted into the database

new_instance

is: ro, isa: CodeRef, lazy: 1, builder: _build_new_instance

This attribute overrides what is provided in Data::Morph::Role::Backend and uses a builder method that returns a coderef that uses "result_set" to return a new row using "new_result" in DBIx::Class::ResultSet

PUBLIC_METHODS

epilogue

(DBIx::Class::Row)

This method implements "epilogue" in Data::Morph::Role::Backend. It reads "auto_insert" to determine if the row should be inserted into the database.

PROTECTED_METHODS

_build_new_instance

This is the builder method for "new_instance". If special logic is needed in creation of the instance factory, simply override or advise this method as needed. By default, it returns a CodeRef that builds DBIx::Class::Row objects using "new_result" in DBIx::Class::ResultSet upon the "result_set"

AUTHOR

Nicholas R. Perez <nperez@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Nicholas R. Perez <nperez@cpan.org>.

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