Michele Beltrame wrote:
> 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
> );
This does a direct UPDATE and doesn't obey inflate_column; that's on the
result class only, not the resultset.
> 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 shouldn't work at all. Did you paste it wrong?
If you mean update() on an object I believe this is fixed in the latest dev
release.
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/