Remove more definition accessor work. Fix property access.
This commit is contained in:
parent
5c494955c0
commit
44c98cf906
1 changed files with 7 additions and 5 deletions
|
|
@ -25,6 +25,9 @@ use Clone qw/clone/;
|
||||||
use WebGUI::DateTime;
|
use WebGUI::DateTime;
|
||||||
use WebGUI::Exception;
|
use WebGUI::Exception;
|
||||||
|
|
||||||
|
define tableName => 'unamed_crud_table';
|
||||||
|
define tableKey => 'id';
|
||||||
|
|
||||||
has session => (
|
has session => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
required => 1,
|
required => 1,
|
||||||
|
|
@ -247,7 +250,7 @@ sub crud_createTable {
|
||||||
my $tableName = $class->meta->tableName();
|
my $tableName = $class->meta->tableName();
|
||||||
$class->crud_dropTable($session);
|
$class->crud_dropTable($session);
|
||||||
$db->write('create table '.$dbh->quote_identifier($tableName).' (
|
$db->write('create table '.$dbh->quote_identifier($tableName).' (
|
||||||
'.$dbh->quote_identifier($class->meta->tableKey($session)).' CHAR(22) binary not null primary key,
|
'.$dbh->quote_identifier($class->meta->tableKey()).' CHAR(22) binary not null primary key,
|
||||||
sequenceNumber int not null default 1,
|
sequenceNumber int not null default 1,
|
||||||
dateCreated datetime,
|
dateCreated datetime,
|
||||||
lastUpdated datetime
|
lastUpdated datetime
|
||||||
|
|
@ -446,8 +449,6 @@ sub crud_updateTable {
|
||||||
my %tableFields = ();
|
my %tableFields = ();
|
||||||
my $sth = $db->read("DESCRIBE ".$tableName);
|
my $sth = $db->read("DESCRIBE ".$tableName);
|
||||||
my $tableKey = $class->meta->tableKey();
|
my $tableKey = $class->meta->tableKey();
|
||||||
use Data::Dumper;
|
|
||||||
warn Dumper ($tableKey);
|
|
||||||
while (my ($col, $type, $null, $key, $default) = $sth->array) {
|
while (my ($col, $type, $null, $key, $default) = $sth->array) {
|
||||||
next if ($col ~~ [$tableKey, 'lastUpdated', 'dateCreated','sequenceNumber']);
|
next if ($col ~~ [$tableKey, 'lastUpdated', 'dateCreated','sequenceNumber']);
|
||||||
$tableFields{$col} = {
|
$tableFields{$col} = {
|
||||||
|
|
@ -459,8 +460,9 @@ sub crud_updateTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
# update existing and create new fields
|
# update existing and create new fields
|
||||||
my $properties = $class->meta->get_all_property_list($session);
|
my @property_names = $class->meta->get_all_properties_list($session);
|
||||||
foreach my $property (keys %{$properties}) {
|
foreach my $property_name (@property_names) {
|
||||||
|
my $property = $class->meta->find_attribute_by_name($property_name);
|
||||||
my $control = WebGUI::Form::DynamicField->new( $session, %{ $properties->{ $property } });
|
my $control = WebGUI::Form::DynamicField->new( $session, %{ $properties->{ $property } });
|
||||||
my $fieldType = $control->getDatabaseFieldType;
|
my $fieldType = $control->getDatabaseFieldType;
|
||||||
my $isKey = $properties->{$property}{isQueryKey};
|
my $isKey = $properties->{$property}{isQueryKey};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue