fixed a bunch of bugs...almost working

This commit is contained in:
JT Smith 2009-10-23 11:07:02 -05:00
parent 509c2d64ee
commit 377c49d141
4 changed files with 17 additions and 7 deletions

View file

@ -1553,9 +1553,9 @@ sub new {
my $placeHolders = [$assetId];
# join all the tables
foreach my $table ($self->getTables) {
$sql .= ",".$definition->{tableName};
$where .= " and (asset.assetId=".$definition->{tableName}.".assetId and ".$definition->{tableName}.".revisionDate=".$revisionDate.")";
foreach my $table ($class->getTables) {
$sql .= ",".$table;
$where .= " and (asset.assetId=".$table.".assetId and ".$table.".revisionDate=".$revisionDate.")";
}
# fetch properties
@ -2290,7 +2290,6 @@ sub update {
$setPairs{$table}{$property} = $value;
}
$self->{_properties}{$property} = $value;
}
}
# if there's anything to update, then do so

View file

@ -123,7 +123,7 @@ sub addRevision {
my %defaults = ();
# get the default values of each property
foreach my $property ($self->getProperties) {
my $defintion = $self->getProperty($property);
my $definition = $self->getProperty($property);
$defaults{$property} = $definition->{defaultValue};
if (ref($defaults{$property}) eq 'ARRAY' && !$definition->{serialize}) {
$defaults{$property} = $defaults{$property}->[0];

View file

@ -50,6 +50,12 @@ sub import {
# ensure we are using c3 method resolution
mro::set_mro($super, 'c3');
mro::set_mro($caller, 'c3');
$class->_build($super, $caller, $definition);
return;
}
sub _build {
my ($class, $super, $caller, $definition) = @_;
# construct an ordered list and hash of the properties
my @propertyList;

View file

@ -50,7 +50,6 @@ sub import {
}
}
}
$class->_install($super, 'getTables', $class->_gen_getTables());
# WebGUI::Definition->import uses caller, so avoid the extra entry in the call stack
my $next = $class->next::can;
@ -58,6 +57,12 @@ sub import {
goto $next;
}
#-------------------------------------------------------------------
sub _build {
my ($class, $super, $caller, $definition) = @_;
$class->_install($super, 'getTables', $class->_gen_getTables());
}
#-------------------------------------------------------------------
sub _gen_getTables {
my $class = shift;
@ -66,7 +71,7 @@ sub _gen_getTables {
my %tables;
foreach my $property ($self->getProperties) {
my $definition = $self->getProperty($property);
%tables{$definition->{tableName}} = 1;
$tables{$definition->{tableName}} = 1;
}
return keys %tables;
};