Carl Franks wrote:
2009/5/26 Toby Corkindale <toby.corkind...@strategicdata.com.au>:
And after applying the patch linked above, the problem went away. Presto!

I'm looking forward to that being included in a 0.04004 release soon..

Thanks - that patch had gotten past my radar!

It's now applied, and new releases of HTML-FormFu and
HTML-FormFu-Model-DBIC have been uploaded to pause, and should be
available on cpan within a couple of hours.

Hi Carl,
The patched version of 0.04004 seemed to work fine, however the released 0.05000 only works on some, but not all, of my tables.

I tracked the issue down to part of HTML::FormFu::Model::DBIC around line 534, where you do:
-----------------------
if ( exists $info->{attrs}{is_foreign_key_constraint} ) {
    $fk_constraint = $info->{attrs}{is_foreign_key_constraint};
}
...
else {
$fk_constraint = not $dbic->result_source->compare_relationship_keys( \...@keys, \...@fpkey );
}

next if($fk_constraint);
...
croak 'The primary key and the foreign key may not be the same column in class '.$fclass if $fpkey eq $fkey;
-----------------------


The tables that break FormFu have relationships defined where the
is_foreign_key_constraint attribute is set to false. If I change it to true, everything seems to work fine.

Eg.
__PACKAGE__->belongs_to(
  gp => 'My::Schema::Result::GP',
  { id => 'gp' },
  { is_foreign_key_constraint => 0 }
);


I didn't write the DB schema so I'm not sure why they indicated these weren't foreign keys, when they are, but I still don't think FormFu should barf on them.

What do you think?

Thanks,
Toby

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to