bug fixes

This commit is contained in:
JT Smith 2009-10-23 18:11:37 -05:00
parent 81c42d7296
commit 908200869e
3 changed files with 16 additions and 5 deletions

View file

@ -1568,8 +1568,9 @@ sub new {
}
if (defined $properties) {
my $object = { _session=>$session, _properties => $properties };
bless $object, $class;
my $object = $class->instantiate;
$object->{_session} = $session;
$object->{_properties} = $properties;
foreach my $property ($object->getProperties) {
my $definition = $object->getProperty($property);
if ($definition->{serialize} && $object->{_properties}->{$property} ne '') {

View file

@ -60,6 +60,7 @@ sub import {
#-------------------------------------------------------------------
sub _build {
my ($class, $super, $caller, $definition) = @_;
$class->next::method($super, $caller, $definition);
$class->_install($super, 'getTables', $class->_gen_getTables());
}
@ -68,12 +69,16 @@ sub _gen_getTables {
my $class = shift;
return sub {
my $self = shift;
my %tables;
my %found;
my @tables;
foreach my $property ($self->getProperties) {
my $definition = $self->getProperty($property);
$tables{$definition->{tableName}} = 1;
unless ($found{$definition->{tableName}}) {
push @tables, $definition->{tableName};
}
$found{$definition->{tableName}} = 1;
}
return keys %tables;
return @tables;
};
}

View file

@ -48,6 +48,11 @@ use WebGUI::Test;
my $object = WGT::Class->instantiate;
can_ok($object, 'getTables');
my @tables = $object->getTables;
is $tables[0], 'mytable', 'found first table';
is $tables[1], 'othertable', 'found second table';
is $object->getProperty('showInForms')->{tableName}, 'mytable',
'properties copy tableName attribute';
is $object->getProperty('confirmChange')->{tableName}, 'othertable',