Add defaults for lastUpdated, dateCreated. Crud data now has to be manually written to the db.
This commit is contained in:
parent
6686860b08
commit
b4abac9a40
2 changed files with 12 additions and 2 deletions
|
|
@ -32,12 +32,21 @@ has session => (
|
|||
|
||||
has lastUpdated => (
|
||||
is => 'rw',
|
||||
lazy => 1,
|
||||
builder => '_now';
|
||||
);
|
||||
|
||||
has dateCreated => (
|
||||
is => 'rw',
|
||||
lazy => 1,
|
||||
builder => '_now';
|
||||
);
|
||||
|
||||
sub _now {
|
||||
my $self = shift;
|
||||
return WebGUI::DateTime->new($session)->toDatabase;
|
||||
}
|
||||
|
||||
has sequenceNumber => (
|
||||
is => 'rw',
|
||||
);
|
||||
|
|
|
|||
5
t/Crud.t
5
t/Crud.t
|
|
@ -31,7 +31,7 @@ define tableName => 'some_crud_table';
|
|||
define tableKey => 'id';
|
||||
|
||||
has id => (
|
||||
is => 'ro',
|
||||
is => 'ro',
|
||||
);
|
||||
|
||||
package main;
|
||||
|
|
@ -81,7 +81,8 @@ is($record2->get('id'),'theshawshankredemption',"custom id works");
|
|||
$record2->delete;
|
||||
|
||||
# instanciation
|
||||
my $record2 = WebGUI::Cruddy->new($session);
|
||||
$record2 = WebGUI::Cruddy->new($session);
|
||||
$record2->write;
|
||||
isnt($record1->getId, $record2->getId, "can retrieve unique rows");
|
||||
my $copyOfRecord2 = WebGUI::Cruddy->new($session, $record2->getId);
|
||||
is($record2->getId, $copyOfRecord2->getId, "can reinstanciate record");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue