Leser: 12
2 Einträge, 1 Seite |
my $person = $schema->resultset('Person')->create({'name' => {'name' => "Mary"}});
1 2
my $name = $schema->resultset('Name')->create({name => 'Mary'}) my $person = $schema->resultset('Person')->create({'name' => {'name' => $name}});
1 2 3 4 5 6 7 8 9 10 11 12
package Main::Name; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto Core/); __PACKAGE__->table('name'); __PACKAGE__->add_columns( id => {data_type => 'integer', is_nullable => 0, is_auto_increment => 1}, name => {data_type => 'varchar',is_nullable => 0,size => 255,}, ); __PACKAGE__->set_primary_key('id'); __PACKAGE__->has_many('persons', 'Main::Person'); __PACKAGE__->add_unique_constraint(['name']); 1;
1 2 3 4 5 6 7 8 9 10
package Main::Person; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto Core/); __PACKAGE__->table('person'); __PACKAGE__->add_columns( id => {data_type => 'integer',is_nullable => 0,is_auto_increment => 1}, name => {data_type => 'integer',is_nullable => 0}, ); __PACKAGE__->set_primary_key('id'); __PACKAGE__->belongs_to(name => 'Main::Name');
1 2 3
package Main; use base qw/DBIx::Class::Schema/; __PACKAGE__->load_classes(qw/ Person Name /);
2 Einträge, 1 Seite |