[Dbix-class] Result column accessors not called with update method?

Adam Witney awitney at sgul.ac.uk
Mon Jun 16 11:11:35 GMT 2014


Hi,

I wrote an accessor on a date column within my Result class, to check if 
the date supplied is not in the future.

This works fine if I use it like so:

$result->collection_date('1/1/2014');

however this doesn't work if I update like so:

$result->update({ collection_date => '1/1/2014' });

This appears to be as documented:

http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultSet.pm#update

But I wondered, is there a way round this or if not, where is the best 
place to put this kind of validation that will work no matter which 
update approach I take?

Thanks for any help

Adam



More information about the DBIx-Class mailing list