Subject: | Invalid error message: "The primary key and the foreign key may not be the same column in class" |
When attempting to update a table (foo) that has a belongs_to
relationship with another table (bar - which has an auto-generated
has_many relationship back to foo), I get an error message:
"The primary key and the foreign key may not be the same column in class
MyDB::Bar"
$info (from line 506 of HTML/FormFu/Model/DBIC.pm) is:
$VAR1 = {
'cond' => {
'foreign.bar_id' => 'self.bar_id'
},
'source' => 'MyDB::Bar',
'attrs' => {
'is_foreign_key_constraint' => 1,
'undef_on_null_fk' => 1,
'accessor' => 'filter'
},
'class' => 'MyDB::Bar'
};
The relationships which are generated by DBIx::Class::Schema::Loader
looks like this:
in MyDB::Bar -
__PACKAGE__->has_many(
"foos",
"MyDB::Foo",
{ "foreign.bar_id" => "self.bar_id" },
);
in MyDB::Foo -
__PACKAGE__->belongs_to(
"bar_id",
"MyDB::Bar",
{ bar_id => "bar_id" },
);
perl 5.10.0 on Darwin 9.7.0 (Mac OS X 10.5.7).