class; requires Class::Accessor::Grouped 0.05002+
- added 97result_class.t test, failing ATM
- added get_inflated_columns to Row
+ - %colinfo accessor and inflate_column now work together
0.07006 2007-04-17 23:18:00
- Lots of documentation updates
$self->throw_exception("inflate_column needs attr hashref")
unless ref $attrs eq 'HASH';
$self->column_info($col)->{_inflate_info} = $attrs;
- $self->mk_group_accessors('inflated_column' => $col);
+ $self->mk_group_accessors('inflated_column' => [$self->column_info($col)->{accessor} || $col, $col]);
return 1;
}
my $schema = DBICTest->init_schema();
-plan tests => 74;
+plan tests => 77;
# figure out if we've got a version of sqlite that is older than 3.2.6, in
# which case COUNT(DISTINCT()) doesn't work
cd => 1,
position => 4,
title => 'Insert or Update',
+ last_updated_on => '1973-07-19 12:01:02'
} );
$new->update_or_insert;
ok($new->in_storage, 'update_or_insert insert ok');
is( $schema->resultset("Track")->find(100)->pos, 5, 'update_or_insert update ok');
# get_inflated_columns w/relation and accessor alias
+isa_ok($new->updated_date, 'DateTime', 'have inflated object via accessor');
my %tdata = $new->get_inflated_columns;
is($tdata{'trackid'}, 100, 'got id');
isa_ok($tdata{'cd'}, 'DBICTest::CD', 'cd is CD object');
is($tdata{'cd'}->id, 1, 'cd object is id 1');
is($tdata{'position'}, 5, 'got position from pos');
is($tdata{'title'}, 'Insert or Update');
+is($tdata{'last_updated_on'}, '1973-07-19T12:01:02');
+isa_ok($tdata{'last_updated_on'}, 'DateTime', 'inflated accessored column');
eval { $schema->class("Track")->load_components('DoesNotExist'); };
DBICTest::Schema::Track;
use base 'DBIx::Class::Core';
+__PACKAGE__->load_components(qw/InflateColumn::DateTime/);
__PACKAGE__->table('track');
__PACKAGE__->add_columns(
data_type => 'varchar',
size => 100,
},
+ last_updated_on => {
+ data_type => 'datetime',
+ accessor => 'updated_date',
+ is_nullable => 1
+ },
);
__PACKAGE__->set_primary_key('trackid');
trackid INTEGER PRIMARY KEY NOT NULL,
cd integer NOT NULL,
position integer NOT NULL,
- title varchar(100) NOT NULL
+ title varchar(100) NOT NULL,
+ last_updated_on datetime NULL
);
--