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

View file

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

View file

@ -50,6 +50,12 @@ sub import {
# ensure we are using c3 method resolution # ensure we are using c3 method resolution
mro::set_mro($super, 'c3'); mro::set_mro($super, 'c3');
mro::set_mro($caller, '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 # construct an ordered list and hash of the properties
my @propertyList; 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 # WebGUI::Definition->import uses caller, so avoid the extra entry in the call stack
my $next = $class->next::can; my $next = $class->next::can;
@ -58,6 +57,12 @@ sub import {
goto $next; goto $next;
} }
#-------------------------------------------------------------------
sub _build {
my ($class, $super, $caller, $definition) = @_;
$class->_install($super, 'getTables', $class->_gen_getTables());
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _gen_getTables { sub _gen_getTables {
my $class = shift; my $class = shift;
@ -66,7 +71,7 @@ sub _gen_getTables {
my %tables; my %tables;
foreach my $property ($self->getProperties) { foreach my $property ($self->getProperties) {
my $definition = $self->getProperty($property); my $definition = $self->getProperty($property);
%tables{$definition->{tableName}} = 1; $tables{$definition->{tableName}} = 1;
} }
return keys %tables; return keys %tables;
}; };