Reputation: 25223
I have InflateColumn
defined like this
__PACKAGE__->inflate_column( request => { inflate => sub{ die }, deflate => sub{ die } } );
But when I try to store data into this column it is stored without problem.
$schema->resultset( 'Table' )->create({
request => 'value'
});
Why is inflate/deflate
not called?
Upvotes: 2
Views: 138
Reputation: 25223
deflate
will be called when value
is an array reference or a hash reference
$schema->resultset( 'Table' )->create({
request => [ 'value' ]
});
UPD The DOC
It will handle all types of references except scalar references. It will not handle scalar values, these are ignored and thus passed through to SQL::Abstract. This is to allow setting raw values to "just work". Scalar references are passed through to the database to deal with, to allow such settings as \'year + 1' and \'DEFAULT' to work.
If you want to filter plain scalar values and replace them with something else, see DBIx::Class::FilterColumn.
Upvotes: 2