[Dbix-class] bad relation name

Octavian Rasnita orasnita at gmail.com
Fri Jan 19 19:07:19 GMT 2007


Hi,

I have created the table class using the Catalyst helper DBIC::Schema but I 
see that it automaticly chooses the same name for the relations as for the 
table rows, so it doesn't work in some cases.
If I will choose other names for the relations, I will need to do this 
manually each time I will run the helper program to re-create the table 
classes.

Isn't there a better way of naming the fields, or running the Catalyst 
helper program, or doing something else that won't require renaming the 
relations manually?

Thank you.

Here is the table class:

package Intra::UserRole;

# Created by DBIx::Class::Schema::Loader v0.03009 @ 2007-01-19 20:56:50

use strict;
use warnings;

use base 'DBIx::Class';

__PACKAGE__->load_components("PK::Auto", "Core");
__PACKAGE__->table("user_role");
__PACKAGE__->add_columns(
  "id_user",
  { data_type => "INT", default_value => 0, is_nullable => 0, size => 10 },
  "id_role",
  { data_type => "INT", default_value => 0, is_nullable => 0, size => 10 },
);
__PACKAGE__->set_primary_key("id_user", "id_role");
__PACKAGE__->belongs_to("id_user", "Intra::User", { id => "id_user" });
__PACKAGE__->belongs_to("id_role", "Intra::Role", { id => "id_role" });

1;

Octavian




More information about the Dbix-class mailing list