morgon has asked for the wisdom of the Perl Monks concerning the following question:
I have a xml-column in a table that I inflate and deflate to an object like this:
This works and I can do the following:__PACKAGE__->inflate_column('xml', { inflate => sub { MyObject->new( xml + => $_[0] ) }, deflate => sub { $_[0]->asXML }, } );
Now assume the MyObject-class has a method "bubba" that changes it's state. Then this does not work:$row->xml(MyObject->new( xml => "<hubba/>" ); # row is now dirty $row->update; # goes to the database
So the problem is that calling methods on the inflated object does not make the column "dirty" for DBIx::Class.$row->xml->bubba("whatever"); #works in memory but column is not co +nsidered dirty $row->update; # does nothing
So my question is how can I (or better the inflated object) tell DBIx::Class that the column is now dirty and should be written back to the database?
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: inflated columns in DBIx::Class
by CountZero (Bishop) on May 04, 2009 at 18:39 UTC | |
by morgon (Priest) on May 05, 2009 at 10:26 UTC | |
by CountZero (Bishop) on May 07, 2009 at 14:49 UTC |