[Maypole-dev] Bug in Maypole::Model::CDBI ?

From: David Baird (dave at riverside-cms.co.uk)
Date: Tue Dec 07 2004 - 14:19:37 GMT


Hi,

Maypole::Model::CDBI::related returns a list, not a hashref. This patch
seems to do the right thing, but this is at the limit of my CDBI-fu so
treat with caution.

Cheers,

d.

--- /usr/lib/perl5/site_perl/5.6.1/Maypole/Model/CDBI.pm Fri Oct
15 23:01:22 2004
+++ Maypole-Model-CDBI/lib/Maypole/Model/CDBI.pm Tue Dec 7
14:08:18 2004
@@ -80,8 +80,13 @@

  sub related_class {
      my ( $self, $r, $accessor ) = @_;
- my $related = $self->related->{$accessor};
- if ( my $mapping = $related->{args}->{mapping} ) {
+
+ my $related = $self->meta_info( has_many => $accessor ) ||
+ $self->meta_info( has_a => $accessor ) ||
+ return;
+
+ my $mapping = $related->{args}->{mapping};
+ if ( @$mapping ) {
          return $related->{foreign_class}->meta_info('has_a')->{
$$mapping[0] }
            ->{foreign_class};
      }

_______________________________________________
maypole-dev mailing list
maypole-dev at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole-dev



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT