X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2FMaypole%2FModel%2FCDBI.pm;h=60619a0e807864454e2d7109955337c957171860;hb=1abc072646e8d37a20ee85c8ca6bb548e2176027;hp=e65caa2ba46f85ad3eac4002409c6a1e55992aa1;hpb=c3973978e1373a262d13da63c9e9ecfde4b72cc7;p=maypole.git diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index e65caa2..60619a0 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -352,8 +352,7 @@ sub related_class { $class->related_meta($col); -Given a column associated with a relationship it will return the relatation -ship type and the meta info for the relationship on the column. +Returns the hash ref of relationship meta info for a given column. =cut @@ -363,7 +362,7 @@ sub related_meta { my $class_meta = $self->meta_info; if (my ($rel_type) = grep { defined $class_meta->{$_}->{$accssr} } keys %$class_meta) - { return $rel_type, $class_meta->{$rel_type}->{$accssr} }; + { return $class_meta->{$rel_type}->{$accssr} }; } @@ -686,23 +685,16 @@ sub column_default { my $info = $class->_column_info->{$col} || eval { $class->_isa_class($col)->_column_info($col) } || return ''; - + my $def = $info->{COLUMN_DEF}; - $def = '' unless defined $def; - - # exclude defaults we don't want to display-- may need some additions here - if ( $class->column_type($col) =~ /^BOOL/i ) { - $def = $def ? 1 : 0; # allow 0 or 1 for bool cols - } - else { - $def = $def =~ /(^0000-00-00.*$|^0[0]*$|^0\.00$|CURRENT_TIMESTAMP|NULL)/i ? '' : $def ; - - } - return $def; + $def = '' unless defined $def; # is this good? + return $def; } + + =head2 get_classmetadata Gets class meta data *excluding cgi input* for the passed in class or the