[Dbix-class] Strange (expected?) inflate_column and update behaviour
Michele Beltrame
mb at italpro.net
Wed Mar 22 12:52:10 CET 2006
Hello!
In a table schema of mine I have:
__PACKAGE__->inflate_column('published', {
inflate => sub { time_db2obj(shift) },
deflate => sub { time_obj2db(shift) },
});
I noticed that the deflate method is NOT called when I use update() on a
resultset an pass data like this:
$c->model('Dbs')->resultset('MyTable')->update(
field1 => 'val',
field2 => 'val'
published => $datetime_object
);
At least, it seems like thid because "cannot compare a DateTime to a
scalar" is thrown. The deflate method IS however regularly called if I
do like this:
$c->model('Dbs')->resultset('MyTable')->published($datetime_object);
$c->update();
That is, if I use named method ( such as published() ) it works,
otherwise it doesn't.
Is this an expected behaviour?
By the way, create() works well and calls the deflator.
Thanks, Michele.
--
Michele Beltrame
http://www.varlogarthas.net/
ICQ# 76660101
Informativa privacy: http://www.italpro.net/em.html
More information about the Dbix-class
mailing list