DBIx::Class::Result::ExternalAttribute - The great new DBIx::Class::Result::ExternalAttribute!
Version 0.06
use attached model to store attribute.
for example artist result:
package t::app::Main::Result::Artist; use base qw/DBIx::Class::Core/; __PACKAGE__->table('artist'); __PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "name", { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }); __PACKAGE__->set_primary_key('id'); __PACKAGE__->load_components(qw/ Result::ExternalAttribute Result::ColumnData /); __PACKAGE__->init_external_attribute( artist_attribute => 't::app::Main::Result::ArtistAttribute', 'artist_id' ); __PACKAGE__->register_relationships_column_data();
use a artist attribute result:
package t::app::Main::Result::ArtistAttribute; use base qw/DBIx::Class::Core/; __PACKAGE__->table('artist_attribute'); __PACKAGE__->add_columns( "artist_id", { data_type => "integer", is_nullable => 0 }, "year_old", { data_type => "integer", is_nullable => 1}); __PACKAGE__->set_primary_key('artist_id'); __PACKAGE__->load_components(qw/ Result::ColumnData /); __PACKAGE__->belongs_to( artist => "t::app::Main::Result::Artist", 'artist_id'); 1;
with this configuration, you can call methods:
$artist->get_column_data => get only columns of artist result $artist->get_column_data_with_attribute => get columns of Artist and ArtistAttribute result except artist_id #update with artist attributes $artist->update({name => "Me", year_old => 15}); #create with artist attributes my $rh = t::app::Main::Result::Artist->prepare_params_with_attribute({name => "Me", year_old => 15}); $schema->resultset('Artist')->create($rh);
A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.
accessor to init_external_attrinute HASH configuration
init function, declare has one relationships
columns_data_with_external_attribute is deprecated, please use get_column_data_with_attribute
extract column_data with attribute column
prepare params for creation with attributes
overdefinition of update function
Nicolas Oudard, <nicolas at oudard.org>
<nicolas at oudard.org>
Please report any bugs or feature requests to bug-dbix-class-result-externalattribute at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-Result-ExternalAttribute. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-dbix-class-result-externalattribute at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc DBIx::Class::Result::ExternalAttribute
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-Result-ExternalAttribute
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/DBIx-Class-Result-ExternalAttribute
CPAN Ratings
http://cpanratings.perl.org/d/DBIx-Class-Result-ExternalAttribute
Search CPAN
http://search.cpan.org/dist/DBIx-Class-Result-ExternalAttribute/
Copyright 2011 Nicolas Oudard.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install DBIx::Class::Result::ExternalAttribute, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::Result::ExternalAttribute
CPAN shell
perl -MCPAN -e shell install DBIx::Class::Result::ExternalAttribute
For more information on module installation, please visit the detailed CPAN module installation guide.